Package com.github.tommyettinger.ds
Class ObjectSet.ObjectSetIterator<T>
java.lang.Object
com.github.tommyettinger.ds.ObjectSet.ObjectSetIterator<T>
- Direct Known Subclasses:
ObjectOrderedSet.ObjectOrderedSetIterator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe current index in the set's key table; this is the index that will be removed ifremove()is called.booleanThis can be queried in place of callinghasNext().protected intThe next index in the set's key table to go to and return fromnext().The set to iterate over.protected booleanInternally employed by the iterator-reuse functionality. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendInto(Collection<T> coll) Append the remaining items that this can iterate through into the given Collection.protected voidbooleanhasNext()iterator()next()voidremove()voidreset()toList()Returns a newObjectListcontaining the remaining items.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
hasNext
public boolean hasNextThis can be queried in place of callinghasNext(). The method also performs a check that the iterator is valid, where using the field does not check. -
nextIndex
protected int nextIndexThe next index in the set's key table to go to and return fromnext(). -
currentIndex
protected int currentIndexThe current index in the set's key table; this is the index that will be removed ifremove()is called. -
valid
protected boolean validInternally employed by the iterator-reuse functionality. -
set
The set to iterate over.
-
-
Constructor Details
-
ObjectSetIterator
-
-
Method Details
-
reset
public void reset() -
findNextIndex
protected void findNextIndex() -
remove
public void remove() -
hasNext
public boolean hasNext() -
next
-
iterator
-
toList
Returns a newObjectListcontaining the remaining items. Does not change the position of this iterator. -
appendInto
Append the remaining items that this can iterate through into the given Collection. Does not change the position of this iterator.- Parameters:
coll- any modifiable Collection; may have items appended into it- Returns:
- the given collection
-