# Spliterators.AbstractLongSpliterator

public static abstract class **Spliterators.AbstractLongSpliterator** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html) An abstract `Spliterator.OfLong` that implements `trySplit`
to permit limited parallelism.

To implement a spliterator an extending class need only
implement `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#tryAdvance(java.util.function.LongConsumer)`
tryAdvance}. The extending class should override
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#forEachRemaining(java.util.function.LongConsumer)` forEach} if it
can provide a more performant implementation.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterators.html#spliterator(java.util.PrimitiveIterator.OfLong,%20long,%20int)`

### Inherited Constant Summary

From interface [java.util.Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)

|---|---|---|
| int | [CONCURRENT](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#CONCURRENT) | Characteristic value signifying that the element source may be safely concurrently modified (allowing additions, replacements, and/or removals) by multiple threads without external synchronization. |
| int | [DISTINCT](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#DISTINCT) | Characteristic value signifying that, for each pair of encountered elements `x, y`, `!x.equals(y)`. |
| int | [IMMUTABLE](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#IMMUTABLE) | Characteristic 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 | [NONNULL](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#NONNULL) | Characteristic value signifying that the source guarantees that encountered elements will not be `null`. |
| int | [ORDERED](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#ORDERED) | Characteristic value signifying that an encounter order is defined for elements. |
| int | [SIZED](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SIZED) | Characteristic 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 | [SORTED](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SORTED) | Characteristic value signifying that encounter order follows a defined sort order. |
| int | [SUBSIZED](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SUBSIZED) | Characteristic value signifying that all Spliterators resulting from `trySplit()` will be both `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SIZED` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SUBSIZED`. |

### Protected Constructor Summary

|---|---|
|   | [AbstractLongSpliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterators.AbstractLongSpliterator.html#AbstractLongSpliterator(long,%20int))(long est, int additionalCharacteristics) Creates a spliterator reporting the given estimated size and characteristics. |

### Public Method Summary

|---|---|
| int | [characteristics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterators.AbstractLongSpliterator.html#characteristics())() Returns a set of characteristics of this Spliterator and its elements. |
| long | [estimateSize](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterators.AbstractLongSpliterator.html#estimateSize())() Returns an estimate of the number of elements that would be encountered by a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#forEachRemaining(java.util.function.Consumer<?%20super%20T>)` traversal, or returns `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html#MAX_VALUE` if infinite, unknown, or too expensive to compute. |
| [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html) | [trySplit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterators.AbstractLongSpliterator.html#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. This implementation permits limited parallelism. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.util.Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html)

|---|---|
| void | [forEachRemaining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#forEachRemaining(java.util.function.LongConsumer))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) action) |
| void | [forEachRemaining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#forEachRemaining(java.util.function.Consumer<?%20super%20java.lang.Long>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super [Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> action) |
| abstract boolean | [tryAdvance](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#tryAdvance(java.util.function.LongConsumer))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) action) |
| boolean | [tryAdvance](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#tryAdvance(java.util.function.Consumer<?%20super%20java.lang.Long>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super [Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> action) |
| abstract [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html) | [trySplit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html#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.OfPrimitive](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfPrimitive.html)

|---|---|
| void | [forEachRemaining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfPrimitive.html#forEachRemaining(T_CONS))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) 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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfPrimitive.html#tryAdvance(T_CONS))([LongConsumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/LongConsumer.html) action) If a remaining element exists, performs the given action on it, returning `true`; else returns `false`. |
| abstract T_SPLITR | [trySplit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfPrimitive.html#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](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)

|---|---|
| abstract int | [characteristics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#characteristics())() Returns a set of characteristics of this Spliterator and its elements. |
| abstract long | [estimateSize](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#estimateSize())() Returns an estimate of the number of elements that would be encountered by a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#forEachRemaining(java.util.function.Consumer<?%20super%20T>)` traversal, or returns `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html#MAX_VALUE` if infinite, unknown, or too expensive to compute. |
| void | [forEachRemaining](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#forEachRemaining(java.util.function.Consumer<?%20super%20T>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? 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. |
| [Comparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html)\<? super T\> | [getComparator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#getComparator())() If this Spliterator's source is `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SORTED` by a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Comparator.html`, returns that `Comparator`. |
| long | [getExactSizeIfKnown](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#getExactSizeIfKnown())() Convenience method that returns `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#estimateSize()` if this Spliterator is `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SIZED`, else `-1`. |
| boolean | [hasCharacteristics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#hasCharacteristics(int))(int characteristics) Returns `true` if this Spliterator's `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#characteristics()` contain all of the given characteristics. |
| abstract boolean | [tryAdvance](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#tryAdvance(java.util.function.Consumer<?%20super%20T>))([Consumer](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Consumer.html)\<? super T\> action) If a remaining element exists, performs the given action on it, returning `true`; else returns `false`. |
| abstract [Spliterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html)\<[Long](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html)\> | [trySplit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#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. |

## Protected Constructors

#### protected
**AbstractLongSpliterator**
(long est, int additionalCharacteristics)

Creates a spliterator reporting the given estimated size and
characteristics.

##### Parameters

| est | the estimated size of this spliterator if known, otherwise `Long.MAX_VALUE`. |
| additionalCharacteristics | properties of this spliterator's source or elements. If `SIZED` is reported then this spliterator will additionally report `SUBSIZED`. |
|---|---|

## Public Methods

#### public int
**characteristics**
()

Returns a set of characteristics of this Spliterator and its
elements. The result is represented as ORed values from `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#ORDERED`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#DISTINCT`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SORTED`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SIZED`,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#NONNULL`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#IMMUTABLE`, `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#CONCURRENT`,
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SUBSIZED`. Repeated calls to `characteristics()` on
a given spliterator, prior to or in-between calls to `trySplit`,
should always return the same result.

If a Spliterator reports an inconsistent set of
characteristics (either those returned from a single invocation
or across multiple invocations), no guarantees can be made
about any computation using this Spliterator.

##### Returns

- a representation of characteristics

#### public long
**estimateSize**
()

Returns an estimate of the number of elements that would be
encountered by a `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#forEachRemaining(java.util.function.Consumer<?%20super%20T>)` traversal, or returns `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Long.html#MAX_VALUE` if infinite, unknown, or too expensive to compute.

If this Spliterator is `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SIZED` and has not yet been partially
traversed or split, or this Spliterator is `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#SUBSIZED` and has
not yet been partially traversed, this estimate must be an accurate
count of elements that would be encountered by a complete traversal.
Otherwise, this estimate may be arbitrarily inaccurate, but must decrease
as specified across invocations of `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#trySplit()`.

##### Returns

- the estimated size, or `Long.MAX_VALUE` if infinite, unknown, or too expensive to compute.

#### public [Spliterator.OfLong](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.OfLong.html)
**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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Spliterator.html#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 to `estimateSize()` for this and the returned Spliterator; and
- if this Spliterator is `SUBSIZED`, then `estimateSize()` for this spliterator before splitting must be equal to the sum of `estimateSize()` 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.

This implementation permits limited parallelism.

##### Returns

- a `Spliterator` covering some portion of the elements, or `null` if this spliterator cannot be split