Interface IntSpliterator

    • 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>>
    • Field Summary

      • Fields inherited from interface java.util.Spliterator

        CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods 
      Modifier and Type Method Description
      default void forEachRemaining​(IntConsumer action)
      Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
      default void forEachRemaining​(java.util.function.Consumer<? super java.lang.Integer> action)
      Deprecated.
      Please use the corresponding type-specific method instead.
      default IntComparator getComparator()
      default long skip​(long n)
      Skips the given number of elements.
      default boolean tryAdvance​(IntConsumer action)
      Attempts to perform the action on the next element, or do nothing but return false if there are no remaining elements.
      default boolean tryAdvance​(java.util.function.Consumer<? super java.lang.Integer> action)
      Deprecated.
      Please use the corresponding type-specific method instead.
      IntSpliterator trySplit()
      • Methods inherited from interface java.util.Spliterator

        characteristics, estimateSize, getExactSizeIfKnown, hasCharacteristics
      • Methods inherited from interface java.util.Spliterator.OfInt

        forEachRemaining, tryAdvance
    • Method Detail

      • tryAdvance

        @Deprecated
        default boolean tryAdvance​(java.util.function.Consumer<? super java.lang.Integer> action)
        Deprecated.
        Please use the corresponding type-specific method instead.
        Specified by:
        tryAdvance in interface java.util.Spliterator<java.lang.Integer>
        Specified by:
        tryAdvance in interface java.util.Spliterator.OfInt
      • tryAdvance

        default boolean tryAdvance​(IntConsumer action)
        Attempts to perform the action on the next element, or do nothing but return false 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.

        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)
      • forEachRemaining

        @Deprecated
        default void forEachRemaining​(java.util.function.Consumer<? super java.lang.Integer> action)
        Deprecated.
        Please use the corresponding type-specific method instead.
        Specified by:
        forEachRemaining in interface java.util.Spliterator<java.lang.Integer>
        Specified by:
        forEachRemaining in interface java.util.Spliterator.OfInt
      • forEachRemaining

        default 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.

        Parameters:
        action - the action to be performed for each element.
        See Also:
        Spliterator.forEachRemaining(java.util.function.Consumer)
      • skip

        default long skip​(long n)
        Skips the given number of elements.

        The effect of this call is exactly the same as that of calling tryAdvance(java.util.function.Consumer<? super java.lang.Integer>) for n times (possibly stopping if tryAdvance(java.util.function.Consumer<? super java.lang.Integer>) returns false). The action called will do nothing; elements will be discarded.

        Parameters:
        n - the number of elements to skip.
        Returns:
        the number of elements actually skipped.
        See Also:
        Spliterator.tryAdvance(java.util.function.Consumer<? super T>)
        Implementation Specification:
        This default implementation is linear in n. It is expected concrete implementations that are capable of it will override it to run lower time, but be prepared for linear time.
      • trySplit

        IntSpliterator trySplit()
        Specified by:
        trySplit in interface java.util.Spliterator<java.lang.Integer>
        Specified by:
        trySplit in interface java.util.Spliterator.OfInt
        Specified by:
        trySplit in interface java.util.Spliterator.OfPrimitive<java.lang.Integer,​java.util.function.IntConsumer,​java.util.Spliterator.OfInt>
        API Notes:
        Note that this specification strengthens the one given in Spliterator.trySplit().
      • getComparator

        default IntComparator getComparator()
        Specified by:
        getComparator in interface java.util.Spliterator<java.lang.Integer>
        API Notes:
        Note that this specification strengthens the one given in Spliterator.getComparator().