001: /*
002: * Primitive Collections for Java.
003: * Copyright (C) 2003 Søren Bak
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package bak.pcj.map;
020:
021: /**
022: * This interface represents iterators over maps from
023: * int values to objects.
024: *
025: * @see bak.pcj.map.IntKeyMap
026: * @see bak.pcj.IntIterator
027: *
028: * @author Søren Bak
029: * @version 1.0 2003/6/1
030: * @since 1.0
031: */
032: public interface IntKeyMapIterator {
033:
034: /**
035: * Indicates whether more entries can be returned by this
036: * iterator.
037: *
038: * @return <tt>true</tt> if more int entries can be returned
039: * by this iterator; returns <tt>false</tt>
040: * otherwise.
041: *
042: * @see #next()
043: */
044: boolean hasNext();
045:
046: /**
047: * Advances to the next entry of this iterator.
048: *
049: * @throws java.util.NoSuchElementException
050: * if no more entries are available from this
051: * iterator.
052: *
053: * @see #hasNext()
054: */
055: void next();
056:
057: /**
058: * Removes the last entry value returned from the underlying
059: * map.
060: *
061: * @throws UnsupportedOperationException
062: * if removal is not supported by this iterator.
063: *
064: * @throws IllegalStateException
065: * if no entry has been returned by this iterator
066: * yet.
067: */
068: void remove();
069:
070: /**
071: * Returns the key of the current entry of this iterator.
072: *
073: * @return the key of the current entry of this iterator.
074: *
075: * @throws IllegalStateException
076: * if there is no current entry (i.e. if
077: * {@link #next() next()}
078: * has not been called or
079: * {@link #remove() remove()}
080: * has just been called.
081: *
082: * @see #getValue()
083: */
084: int getKey();
085:
086: /**
087: * Returns the value of the current entry of this iterator.
088: *
089: * @return the value of the current entry of this iterator
090: * (which may be null).
091: *
092: * @throws IllegalStateException
093: * if there is no current entry (i.e. if
094: * {@link #next() next()}
095: * has not been called or
096: * {@link #remove() remove()}
097: * has just been called.
098: *
099: * @see #getKey()
100: */
101: Object getValue();
102:
103: }
|