Spliterators.AbstractLongSpliterator (Java SE 10 & JDK 10 ) (original) (raw)
Constructor Detail
* #### AbstractLongSpliterator
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`.
Method Detail
* #### trySplit
public [Spliterator.OfLong](../../java/util/Spliterator.OfLong.html "interface in java.util") 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 [Spliterator.ORDERED](../../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.
Specified by:
`[trySplit](../../java/util/Spliterator.html#trySplit%28%29)` in interface `[Spliterator](../../java/util/Spliterator.html "interface in java.util")<[Long](../../java/lang/Long.html "class in java.lang")>`
Specified by:
`[trySplit](../../java/util/Spliterator.OfLong.html#trySplit%28%29)` in interface `[Spliterator.OfLong](../../java/util/Spliterator.OfLong.html "interface in java.util")`
Specified by:
`[trySplit](../../java/util/Spliterator.OfPrimitive.html#trySplit%28%29)` in interface `[Spliterator.OfPrimitive](../../java/util/Spliterator.OfPrimitive.html "interface in java.util")<[Long](../../java/lang/Long.html "class in java.lang"),[LongConsumer](../../java/util/function/LongConsumer.html "interface in java.util.function"),[Spliterator.OfLong](../../java/util/Spliterator.OfLong.html "interface in java.util")>`
Returns:
a `Spliterator` covering some portion of the elements, or `null` if this spliterator cannot be split
* #### estimateSize
public long estimateSize()
Specified by:
`[estimateSize](../../java/util/Spliterator.html#estimateSize%28%29)` in interface `[Spliterator](../../java/util/Spliterator.html "interface in java.util")<[Long](../../java/lang/Long.html "class in java.lang")>`
Implementation Requirements:
This implementation returns the estimated size as reported when created and, if the estimate size is known, decreases in size when split.
Returns:
the estimated size, or `Long.MAX_VALUE` if infinite, unknown, or too expensive to compute.
* #### characteristics
public int characteristics()
Returns a set of characteristics of this Spliterator and its elements. The result is represented as ORed values from [Spliterator.ORDERED](../../java/util/Spliterator.html#ORDERED), [Spliterator.DISTINCT](../../java/util/Spliterator.html#DISTINCT), [Spliterator.SORTED](../../java/util/Spliterator.html#SORTED), [Spliterator.SIZED](../../java/util/Spliterator.html#SIZED),[Spliterator.NONNULL](../../java/util/Spliterator.html#NONNULL), [Spliterator.IMMUTABLE](../../java/util/Spliterator.html#IMMUTABLE), [Spliterator.CONCURRENT](../../java/util/Spliterator.html#CONCURRENT),[Spliterator.SUBSIZED](../../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.
Specified by:
`[characteristics](../../java/util/Spliterator.html#characteristics%28%29)` in interface `[Spliterator](../../java/util/Spliterator.html "interface in java.util")<[Long](../../java/lang/Long.html "class in java.lang")>`
Implementation Requirements:
This implementation returns the characteristics as reported when created.
Returns:
a representation of characteristics