Package com.carrotsearch.hppc
Class AbstractIterator<E>
- java.lang.Object
-
- com.carrotsearch.hppc.AbstractIterator<E>
-
- All Implemented Interfaces:
java.util.Iterator<E>
- Direct Known Subclasses:
ByteArrayDeque.DescendingValueIterator,ByteArrayDeque.ValueIterator,ByteArrayList.ValueIterator,ByteByteHashMap.EntryIterator,ByteByteHashMap.KeysIterator,ByteByteHashMap.ValuesIterator,ByteCharHashMap.EntryIterator,ByteCharHashMap.KeysIterator,ByteCharHashMap.ValuesIterator,ByteDoubleHashMap.EntryIterator,ByteDoubleHashMap.KeysIterator,ByteDoubleHashMap.ValuesIterator,ByteFloatHashMap.EntryIterator,ByteFloatHashMap.KeysIterator,ByteFloatHashMap.ValuesIterator,ByteHashSet.EntryIterator,ByteIntHashMap.EntryIterator,ByteIntHashMap.KeysIterator,ByteIntHashMap.ValuesIterator,ByteLongHashMap.EntryIterator,ByteLongHashMap.KeysIterator,ByteLongHashMap.ValuesIterator,ByteObjectHashMap.EntryIterator,ByteObjectHashMap.KeysIterator,ByteObjectHashMap.ValuesIterator,ByteShortHashMap.EntryIterator,ByteShortHashMap.KeysIterator,ByteShortHashMap.ValuesIterator,CharArrayDeque.DescendingValueIterator,CharArrayDeque.ValueIterator,CharArrayList.ValueIterator,CharByteHashMap.EntryIterator,CharByteHashMap.KeysIterator,CharByteHashMap.ValuesIterator,CharCharHashMap.EntryIterator,CharCharHashMap.KeysIterator,CharCharHashMap.ValuesIterator,CharDoubleHashMap.EntryIterator,CharDoubleHashMap.KeysIterator,CharDoubleHashMap.ValuesIterator,CharFloatHashMap.EntryIterator,CharFloatHashMap.KeysIterator,CharFloatHashMap.ValuesIterator,CharHashSet.EntryIterator,CharIntHashMap.EntryIterator,CharIntHashMap.KeysIterator,CharIntHashMap.ValuesIterator,CharLongHashMap.EntryIterator,CharLongHashMap.KeysIterator,CharLongHashMap.ValuesIterator,CharObjectHashMap.EntryIterator,CharObjectHashMap.KeysIterator,CharObjectHashMap.ValuesIterator,CharShortHashMap.EntryIterator,CharShortHashMap.KeysIterator,CharShortHashMap.ValuesIterator,DoubleArrayDeque.DescendingValueIterator,DoubleArrayDeque.ValueIterator,DoubleArrayList.ValueIterator,DoubleByteHashMap.EntryIterator,DoubleByteHashMap.KeysIterator,DoubleByteHashMap.ValuesIterator,DoubleCharHashMap.EntryIterator,DoubleCharHashMap.KeysIterator,DoubleCharHashMap.ValuesIterator,DoubleDoubleHashMap.EntryIterator,DoubleDoubleHashMap.KeysIterator,DoubleDoubleHashMap.ValuesIterator,DoubleFloatHashMap.EntryIterator,DoubleFloatHashMap.KeysIterator,DoubleFloatHashMap.ValuesIterator,DoubleHashSet.EntryIterator,DoubleIntHashMap.EntryIterator,DoubleIntHashMap.KeysIterator,DoubleIntHashMap.ValuesIterator,DoubleLongHashMap.EntryIterator,DoubleLongHashMap.KeysIterator,DoubleLongHashMap.ValuesIterator,DoubleObjectHashMap.EntryIterator,DoubleObjectHashMap.KeysIterator,DoubleObjectHashMap.ValuesIterator,DoubleShortHashMap.EntryIterator,DoubleShortHashMap.KeysIterator,DoubleShortHashMap.ValuesIterator,FloatArrayDeque.DescendingValueIterator,FloatArrayDeque.ValueIterator,FloatArrayList.ValueIterator,FloatByteHashMap.EntryIterator,FloatByteHashMap.KeysIterator,FloatByteHashMap.ValuesIterator,FloatCharHashMap.EntryIterator,FloatCharHashMap.KeysIterator,FloatCharHashMap.ValuesIterator,FloatDoubleHashMap.EntryIterator,FloatDoubleHashMap.KeysIterator,FloatDoubleHashMap.ValuesIterator,FloatFloatHashMap.EntryIterator,FloatFloatHashMap.KeysIterator,FloatFloatHashMap.ValuesIterator,FloatHashSet.EntryIterator,FloatIntHashMap.EntryIterator,FloatIntHashMap.KeysIterator,FloatIntHashMap.ValuesIterator,FloatLongHashMap.EntryIterator,FloatLongHashMap.KeysIterator,FloatLongHashMap.ValuesIterator,FloatObjectHashMap.EntryIterator,FloatObjectHashMap.KeysIterator,FloatObjectHashMap.ValuesIterator,FloatShortHashMap.EntryIterator,FloatShortHashMap.KeysIterator,FloatShortHashMap.ValuesIterator,IntArrayDeque.DescendingValueIterator,IntArrayDeque.ValueIterator,IntArrayList.ValueIterator,IntByteHashMap.EntryIterator,IntByteHashMap.KeysIterator,IntByteHashMap.ValuesIterator,IntCharHashMap.EntryIterator,IntCharHashMap.KeysIterator,IntCharHashMap.ValuesIterator,IntDoubleHashMap.EntryIterator,IntDoubleHashMap.KeysIterator,IntDoubleHashMap.ValuesIterator,IntFloatHashMap.EntryIterator,IntFloatHashMap.KeysIterator,IntFloatHashMap.ValuesIterator,IntHashSet.EntryIterator,IntIntHashMap.EntryIterator,IntIntHashMap.KeysIterator,IntIntHashMap.ValuesIterator,IntLongHashMap.EntryIterator,IntLongHashMap.KeysIterator,IntLongHashMap.ValuesIterator,IntObjectHashMap.EntryIterator,IntObjectHashMap.KeysIterator,IntObjectHashMap.ValuesIterator,IntShortHashMap.EntryIterator,IntShortHashMap.KeysIterator,IntShortHashMap.ValuesIterator,LongArrayDeque.DescendingValueIterator,LongArrayDeque.ValueIterator,LongArrayList.ValueIterator,LongByteHashMap.EntryIterator,LongByteHashMap.KeysIterator,LongByteHashMap.ValuesIterator,LongCharHashMap.EntryIterator,LongCharHashMap.KeysIterator,LongCharHashMap.ValuesIterator,LongDoubleHashMap.EntryIterator,LongDoubleHashMap.KeysIterator,LongDoubleHashMap.ValuesIterator,LongFloatHashMap.EntryIterator,LongFloatHashMap.KeysIterator,LongFloatHashMap.ValuesIterator,LongHashSet.EntryIterator,LongIntHashMap.EntryIterator,LongIntHashMap.KeysIterator,LongIntHashMap.ValuesIterator,LongLongHashMap.EntryIterator,LongLongHashMap.KeysIterator,LongLongHashMap.ValuesIterator,LongObjectHashMap.EntryIterator,LongObjectHashMap.KeysIterator,LongObjectHashMap.ValuesIterator,LongShortHashMap.EntryIterator,LongShortHashMap.KeysIterator,LongShortHashMap.ValuesIterator,ObjectArrayDeque.DescendingValueIterator,ObjectArrayDeque.ValueIterator,ObjectArrayList.ValueIterator,ObjectByteHashMap.EntryIterator,ObjectByteHashMap.KeysIterator,ObjectByteHashMap.ValuesIterator,ObjectCharHashMap.EntryIterator,ObjectCharHashMap.KeysIterator,ObjectCharHashMap.ValuesIterator,ObjectDoubleHashMap.EntryIterator,ObjectDoubleHashMap.KeysIterator,ObjectDoubleHashMap.ValuesIterator,ObjectFloatHashMap.EntryIterator,ObjectFloatHashMap.KeysIterator,ObjectFloatHashMap.ValuesIterator,ObjectHashSet.EntryIterator,ObjectIntHashMap.EntryIterator,ObjectIntHashMap.KeysIterator,ObjectIntHashMap.ValuesIterator,ObjectLongHashMap.EntryIterator,ObjectLongHashMap.KeysIterator,ObjectLongHashMap.ValuesIterator,ObjectObjectHashMap.EntryIterator,ObjectObjectHashMap.KeysIterator,ObjectObjectHashMap.ValuesIterator,ObjectShortHashMap.EntryIterator,ObjectShortHashMap.KeysIterator,ObjectShortHashMap.ValuesIterator,ShortArrayDeque.DescendingValueIterator,ShortArrayDeque.ValueIterator,ShortArrayList.ValueIterator,ShortByteHashMap.EntryIterator,ShortByteHashMap.KeysIterator,ShortByteHashMap.ValuesIterator,ShortCharHashMap.EntryIterator,ShortCharHashMap.KeysIterator,ShortCharHashMap.ValuesIterator,ShortDoubleHashMap.EntryIterator,ShortDoubleHashMap.KeysIterator,ShortDoubleHashMap.ValuesIterator,ShortFloatHashMap.EntryIterator,ShortFloatHashMap.KeysIterator,ShortFloatHashMap.ValuesIterator,ShortHashSet.EntryIterator,ShortIntHashMap.EntryIterator,ShortIntHashMap.KeysIterator,ShortIntHashMap.ValuesIterator,ShortLongHashMap.EntryIterator,ShortLongHashMap.KeysIterator,ShortLongHashMap.ValuesIterator,ShortObjectHashMap.EntryIterator,ShortObjectHashMap.KeysIterator,ShortObjectHashMap.ValuesIterator,ShortShortHashMap.EntryIterator,ShortShortHashMap.KeysIterator,ShortShortHashMap.ValuesIterator
public abstract class AbstractIterator<E> extends java.lang.Object implements java.util.Iterator<E>Simplifies the implementation of iterators a bit. Modeled loosely after Google Guava's API.
-
-
Field Summary
Fields Modifier and Type Field Description private static intAT_ENDprivate static intCACHEDprivate EnextElementThe next element to be returned fromnext()if fetched.private static intNOT_CACHEDprivate intstateCurrent iterator state.
-
Constructor Summary
Constructors Constructor Description AbstractIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Edone()Call when done.protected abstract Efetch()Fetch next element.booleanhasNext()Enext()voidremove()Default implementation throwsUnsupportedOperationException.
-
-
-
Field Detail
-
NOT_CACHED
private static final int NOT_CACHED
- See Also:
- Constant Field Values
-
CACHED
private static final int CACHED
- See Also:
- Constant Field Values
-
AT_END
private static final int AT_END
- See Also:
- Constant Field Values
-
state
private int state
Current iterator state.
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<E>
-
remove
public void remove()
Default implementation throwsUnsupportedOperationException.- Specified by:
removein interfacejava.util.Iterator<E>
-
fetch
protected abstract E fetch()
Fetch next element. The implementation must returndone()when all elements have been fetched.- Returns:
- Returns the next value for the iterator or chain-calls
done().
-
done
protected final E done()
Call when done.- Returns:
- Returns a unique sentinel value to indicate end-of-iteration.
-
-