Class AbstractIntSpliterator
- java.lang.Object
-
- it.unimi.dsi.fastutil.ints.AbstractIntSpliterator
-
- All Implemented Interfaces:
IntSpliterator
,java.util.Spliterator<java.lang.Integer>
,java.util.Spliterator.OfInt
,java.util.Spliterator.OfPrimitive<java.lang.Integer,java.util.function.IntConsumer,java.util.Spliterator.OfInt>
- Direct Known Subclasses:
IntBigSpliterators.AbstractIndexBasedSpliterator
,IntSpliterators.AbstractIndexBasedSpliterator
public abstract class AbstractIntSpliterator extends java.lang.Object implements IntSpliterator
An abstract class facilitating the creation of type-specific iterators.- API Notes:
- Presently the class hosts
finalized versions of default delegating methods such as
forEachRemaining(it.unimi.dsi.fastutil.ints.IntConsumer)
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Spliterator
java.util.Spliterator.OfDouble, java.util.Spliterator.OfInt, java.util.Spliterator.OfLong, java.util.Spliterator.OfPrimitive<T extends java.lang.Object,T_CONS extends java.lang.Object,T_SPLITR extends java.util.Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forEachRemaining(IntConsumer action)
Performs the given action for each remaining element until all elements have been processed or the action throws an exception.boolean
tryAdvance(IntConsumer action)
Attempts to perform the action on the next element, or do nothing but returnfalse
if there are no remaining elements.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntSpliterator
forEachRemaining, getComparator, skip, tryAdvance, trySplit
-
-
-
-
Method Detail
-
tryAdvance
public final boolean tryAdvance(IntConsumer action)
Attempts to perform the action on the next element, or do nothing but returnfalse
if there are no remaining elements.WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the
tryAdvance()
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.- Specified by:
tryAdvance
in interfaceIntSpliterator
- Parameters:
action
- the action to be performed on the next element.- Returns:
- whether there was a next element the action was performed on
- See Also:
Spliterator.tryAdvance(java.util.function.Consumer)
- Implementation Specification:
- This method just delegates to the interface default method, as the default method, but it is final, so it cannot be overridden.
-
forEachRemaining
public final void forEachRemaining(IntConsumer action)
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.- Specified by:
forEachRemaining
in interfaceIntSpliterator
- Parameters:
action
- the action to be performed for each element.- See Also:
Spliterator.forEachRemaining(java.util.function.Consumer)
- Implementation Specification:
- This method just delegates to the interface default method, as the default method, but it is final, so it cannot be overridden.
-
-