Module org.jhotdraw8.collection
Interface Enumerator.OfLong
- All Superinterfaces:
BareEnumerator<Long>,Enumerator<Long>,Spliterator<Long>,Spliterator.OfLong,Spliterator.OfPrimitive<Long,LongConsumer, Spliterator.OfLong>
- All Known Implementing Classes:
AbstractLongEnumerator
- Enclosing interface:
Enumerator<E>
An object for enumerating primitive long-valued elements of a collection.
The protocol for accessing elements via a Enumerator imposes smaller per-element overhead than
Iterator, and avoids the inherent race involved in having separate methods for
hasNext() and next().
- Author:
- Werner Randelshofer
-
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 -
Method Summary
Modifier and TypeMethodDescriptioncurrent()Gets the element in the collection at the current position of the enumerator.longReturns the current value.default booleantryAdvance(@NonNull Consumer<? super Long> action) default booleantryAdvance(@NonNull LongConsumer action) Methods inherited from interface org.jhotdraw8.collection.enumerator.BareEnumerator
moveNextMethods inherited from interface java.util.Spliterator
characteristics, estimateSize, getComparator, getExactSizeIfKnown, hasCharacteristicsMethods inherited from interface java.util.Spliterator.OfLong
forEachRemaining, forEachRemaining, trySplit
-
Method Details
-
current
Gets 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<Long>- Returns:
- current
- The enumerator is positioned before the first element in the collection.
Immediately after the enumerator is created
-
currentAsLong
long currentAsLong()Returns the current value.- Returns:
- current
- See Also:
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator.OfLong- Specified by:
tryAdvancein interfaceSpliterator.OfPrimitive<Long,LongConsumer, Spliterator.OfLong>
-
tryAdvance
- Specified by:
tryAdvancein interfaceEnumerator<Long>- Specified by:
tryAdvancein interfaceSpliterator<Long>- Specified by:
tryAdvancein interfaceSpliterator.OfLong
-