Package it.unimi.dsi.fastutil.ints
Interface IntIterator
- All Superinterfaces:
Iterator<Integer>,PrimitiveIterator<Integer,,IntConsumer> PrimitiveIterator.OfInt
- All Known Subinterfaces:
IntBidirectionalIterator,IntBigListIterator,IntListIterator
- All Known Implementing Classes:
AbstractIntBidirectionalIterator,AbstractIntBigListIterator,AbstractIntIterator,AbstractIntListIterator,IntBigListIterators.AbstractIndexBasedBigIterator,IntBigListIterators.AbstractIndexBasedBigListIterator,IntBigListIterators.BigListIteratorListIterator,IntBigListIterators.EmptyBigListIterator,IntBigListIterators.UnmodifiableBigListIterator,IntIterators.AbstractIndexBasedIterator,IntIterators.AbstractIndexBasedListIterator,IntIterators.EmptyIterator,IntIterators.UnmodifiableBidirectionalIterator,IntIterators.UnmodifiableIterator,IntIterators.UnmodifiableListIterator
A type-specific
Iterator; provides an additional method to avoid (un)boxing, and the
possibility to skip elements.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong -
Method Summary
Modifier and TypeMethodDescriptiondefault voidforEachRemaining(IntConsumer action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.default voidforEachRemaining(Consumer<? super Integer> action) Deprecated.Please use the corresponding type-specific method instead.default Integernext()Deprecated.Please use the corresponding type-specific method instead.intnextInt()Returns the next element as a primitive type.default intskip(int n) Skips the given number of elements.Methods inherited from interface java.util.PrimitiveIterator.OfInt
forEachRemaining
-
Method Details
-
nextInt
int nextInt()Returns the next element as a primitive type.- Specified by:
nextIntin interfacePrimitiveIterator.OfInt- Returns:
- the next element in the iteration.
- See Also:
-
next
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
nextin interfaceIterator<Integer>- Specified by:
nextin interfacePrimitiveIterator.OfInt
-
forEachRemaining
Performs the given action for each remaining element until all elements have been processed or the action throws an exception.WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the
forEachRemaining()overload that uses the JDK's primitive consumer type (e.g.IntConsumer).If Java supported final default methods, this would be one, but sadly it does not.
If you checked and are overriding the version with
java.util.function.XConsumer, and still see this warning, then your IDE is incorrectly conflating this method with the proper method to override, and you can safely ignore this message.- Parameters:
action- the action to be performed for each element.- Since:
- 8.5.0
- See Also:
-
forEachRemaining
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
forEachRemainingin interfaceIterator<Integer>- Specified by:
forEachRemainingin interfacePrimitiveIterator.OfInt
-
skip
default int skip(int n) Skips the given number of elements.The effect of this call is exactly the same as that of calling
next()forntimes (possibly stopping ifIterator.hasNext()becomes false).- Parameters:
n- the number of elements to skip.- Returns:
- the number of elements actually skipped.
- See Also:
-