Module org.jhotdraw8.collection
Class SingletonSpliterator<E>
java.lang.Object
java.util.Spliterators.AbstractSpliterator<E>
org.jhotdraw8.collection.spliterator.SingletonSpliterator<E>
- Type Parameters:
E- the element type
- All Implemented Interfaces:
Spliterator<E>,BareEnumerator<E>,Enumerator<E>
public class SingletonSpliterator<E>
extends Spliterators.AbstractSpliterator<E>
implements Enumerator<E>
An enumerator over a single element.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jhotdraw8.collection.enumerator.Enumerator
Enumerator.OfDouble, Enumerator.OfInt, Enumerator.OfLongNested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.Spliterators.AbstractSpliterator
characteristics, trySplitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jhotdraw8.collection.enumerator.Enumerator
tryAdvanceMethods inherited from interface java.util.Spliterator
characteristics, forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics, trySplit
-
Constructor Details
-
SingletonSpliterator
-
-
Method Details
-
moveNext
public boolean moveNext()Description copied from interface:BareEnumeratorAdvances the enumerator to the next element of the collection.- Specified by:
moveNextin interfaceBareEnumerator<E>- Returns:
- true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
-
current
Description copied from interface:BareEnumeratorGets the element in the collection at the current position of the enumerator.Current is undefined under any of the following conditions:
- The enumerator is positioned before the first element in the collection.
Immediately after the enumerator is created
BareEnumerator.moveNext()must be called to advance the enumerator to the first element of the collection before reading the value of Current. - The last call to
BareEnumerator.moveNext()returned false, which indicates the end of the collection. - The enumerator is invalidated due to changes made in the collection, such as adding, modifying, or deleting elements.
- Specified by:
currentin interfaceBareEnumerator<E>- Returns:
- current
- The enumerator is positioned before the first element in the collection.
Immediately after the enumerator is created
-
estimateSize
public long estimateSize()- Specified by:
estimateSizein interfaceSpliterator<E>- Overrides:
estimateSizein classSpliterators.AbstractSpliterator<E>
-