public interface Splittable<S extends Splittable<S>>
This does a similar job to Spliterator
,
but it imposes no assumptions about the form of the split objects,
for instance that they form a sequence that can be iterated over
internally, which idiom forms the basis of the Java 8 streams framework.
Collections or sequences based on Splittable can use external
iteration, which allows better control in some cases.
Modifier and Type | Method and Description |
---|---|
S |
split()
Attempts to partition this object into two halves,
ideally of similar size.
|
long |
splittableSize()
Provides an estimate of the number of processable items in this object.
|
S split()
Following a successful call, the two parts may be processed in different threads.
Spliterator.trySplit()
long splittableSize()
If no estimate for the size is available, a negative value should be returned.