New Collections interface - Sized
forax at univ-mlv.fr
forax at univ-mlv.fr
Fri Apr 23 22:56:12 UTC 2021
----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "Stephen Colebourne" <scolebourne at joda.org>
> Cc: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Samedi 24 Avril 2021 00:40:54
> Objet: Re: New Collections interface - Sized
>> This is basically Spliterator, an iterator + a size, with the iterator is "push"
>> instead of "pull" because it's more efficient.
>>
>> In details a Spliterator is either
>> - an Iterable (with no SIZED characteristic)
>> - an Iterable + size (if SIZED and estimateSize() != Long.MAX_VALUE)
>> - an Iterable + comparator (if SORTED and comparator != null)
>> - an Iterable + split (if trySplit != null)
>>
>> and all combinations of the above.
oops, i've written Iterable instead of Iterator.
>>
> So, you're asking for Spliterable<T>, no? :)
a Supplier<Spliterator<T>> is a Spliterable<T>, as in StreamSupport.stream() [1].
Rémi
[1] https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/stream/StreamSupport.html#stream(java.util.function.Supplier,int,boolean)
More information about the core-libs-dev
mailing list