Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
  
  
Spliterator.OfLong
  public
  static
  
  
  interface
  Spliterator.OfLong
  
  
      implements
      
        OfPrimitive<Long, LongConsumer, Spliterator.OfLong>
      
  
  
  
    
    | java.util.Spliterator.OfLong | 
  
  
  
    
      | 
          Known indirect subclasses
          
  
  
         | 
  
    
  A Spliterator specialized for long values.
Summary
| Inherited constants | 
|---|
  
  | 
      From interface
        java.util.Spliterator
        
    
    
        | int | CONCURRENTCharacteristic value signifying that the element source may be safely
 concurrently modified (allowing additions, replacements, and/or removals)
 by multiple threads without external synchronization.
          
    
 |  
        | int | DISTINCTCharacteristic value signifying that, for each pair of
 encountered elements x, y,!x.equals(y). |  
        | int | IMMUTABLECharacteristic value signifying that the element source cannot be
 structurally modified; that is, elements cannot be added, replaced, or
 removed, so such changes cannot occur during traversal.
          
    
 |  
        | int | NONNULLCharacteristic value signifying that the source guarantees that
 encountered elements will not be null. |  
        | int | ORDEREDCharacteristic value signifying that an encounter order is defined for
 elements.
          
    
 |  
        | int | SIZEDCharacteristic value signifying that the value returned from
 estimateSize()prior to traversal or splitting represents a
 finite size that, in the absence of structural source modification,
 represents an exact count of the number of elements that would be
 encountered by a complete traversal. |  
        | int | SORTEDCharacteristic value signifying that encounter order follows a defined
 sort order.
          
    
 |  
        | int | SUBSIZEDCharacteristic value signifying that all Spliterators resulting from
 trySplit()will be bothSIZEDandSUBSIZED. |  | 
| Inherited methods | 
|---|
| 
    From interface
      
        
          java.util.Spliterator.OfPrimitive
        
      
      
  
  
  
    | 
        
        default
        
        
        
        void | 
      forEachRemaining(LongConsumer action)
      Performs the given action for each remaining element, sequentially in
 the current thread, until all elements have been processed or the
 action throws an exception.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        boolean | 
      tryAdvance(LongConsumer action)
      If a remaining element exists, performs the given action on it,
 returning true; else returnsfalse. |  
  
  
    | 
        abstract
        
        
        
        
        T_SPLITR | 
      trySplit()
      If this spliterator can be partitioned, returns a Spliterator
 covering elements, that will, upon return from this method, not
 be covered by this Spliterator.
        
    
 |  | 
| 
    From interface
      
        
          java.util.Spliterator
        
      
      
  
  
  
    | 
        abstract
        
        
        
        
        int | 
      characteristics()
      Returns a set of characteristics of this Spliterator and its
 elements.
        
    
 |  
  
  
    | 
        abstract
        
        
        
        
        long | 
      estimateSize()
      Returns an estimate of the number of elements that would be
 encountered by a forEachRemaining(Consumer)traversal, or returnsLong.MAX_VALUEif infinite, unknown, or too expensive to compute. |  
  
  
    | 
        
        default
        
        
        
        void | 
      forEachRemaining(Consumer<? super T> action)
      Performs the given action for each remaining element, sequentially in
 the current thread, until all elements have been processed or the action
 throws an exception.
        
    
 |  
  
  
    | 
        
        default
        
        
        
        Comparator<? super T> | 
      getComparator()
      If this Spliterator's source is SORTEDby aComparator,
 returns thatComparator. |  
  
  
    | 
        
        default
        
        
        
        long | 
      getExactSizeIfKnown()
      Convenience method that returns estimateSize()if this
 Spliterator isSIZED, else-1. |  
  
  
    | 
        
        default
        
        
        
        boolean | 
      hasCharacteristics(int characteristics)
      Returns trueif this Spliterator'scharacteristics()contain all of the given characteristics. |  
  
  
    | 
        abstract
        
        
        
        
        boolean | 
      tryAdvance(Consumer<? super T> action)
      If a remaining element exists: performs the given action on it,
 returning true; else returnsfalse. |  
  
  
    | 
        abstract
        
        
        
        
        Spliterator<Long> | 
      trySplit()
      If this spliterator can be partitioned, returns a Spliterator
 covering elements, that will, upon return from this method, not
 be covered by this Spliterator.
        
    
 |  | 
Public methods
    forEachRemaining
    
public void forEachRemaining (LongConsumer action)
    
    
    
  
    
    | Parameters | 
|---|
      
        | action | LongConsumer | 
    
 
    forEachRemaining
    
public void forEachRemaining (Consumer<? super Long> action)
    
    
    
  
    
        
          Implementation Requirements:
          
         
    
    | Parameters | 
|---|
      
        | action | Consumer | 
    
 
    tryAdvance
    
public abstract boolean tryAdvance (LongConsumer action)
    
    
    
  
    
    | Parameters | 
|---|
      
        | action | LongConsumer | 
    
    
 
    tryAdvance
    
public boolean tryAdvance (Consumer<? super Long> action)
    
    
    
  
    
        
          Implementation Requirements:
          
         
    
    | Parameters | 
|---|
      
        | action | Consumer | 
    
    
 
    trySplit
    
public abstract Spliterator.OfLong trySplit ()
    
    
    
  If this spliterator can be partitioned, returns a Spliterator
 covering elements, that will, upon return from this method, not
 be covered by this Spliterator.
 
If this Spliterator is ORDERED, the returned Spliterator
 must cover a strict prefix of the elements.
 
Unless this Spliterator covers an infinite number of elements,
 repeated calls to trySplit() must eventually return null.
 Upon non-null return:
 
 - the value reported for estimateSize()before splitting,
 must, after splitting, be greater than or equal toestimateSize()for this and the returned Spliterator; and
- if this Spliterator is SUBSIZED, thenestimateSize()for this spliterator before splitting must be equal to the sum ofestimateSize()for this and the returned Spliterator after
 splitting.
This method may return null for any reason,
 including emptiness, inability to split after traversal has
 commenced, data structure constraints, and efficiency
 considerations.
    
      | Returns | 
|---|
      
        | Spliterator.OfLong | a Spliteratorcovering some portion of the
 elements, ornullif this spliterator cannot be split | 
    
 
 
 
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]