Re: New Collections interface - Sized

2021-04-23 Thread forax
- Mail original - > De: "Brian Goetz" > À: "Remi Forax" , "Stephen Colebourne" > > Cc: "core-libs-dev" > Envoyé: Samedi 24 Avril 2021 00:40:54 > Objet: Re: New Collections interface - Sized >> This is basically S

Re: New Collections interface - Sized

2021-04-23 Thread Remi Forax
- Mail original - > De: "Stephen Colebourne" > À: "core-libs-dev" > Envoyé: Vendredi 23 Avril 2021 11:23:03 > Objet: New Collections interface - Sized > Hi all, > While a discussion on ReversibleCollection is going on, I'd like to > rais

Re: New Collections interface - Sized

2021-04-23 Thread Brian Goetz
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 +

Re: New Collections interface - Sized

2021-04-23 Thread Remi Forax
- Mail original - > De: "Stephen Colebourne" > À: "core-libs-dev" > Envoyé: Samedi 24 Avril 2021 00:14:51 > Objet: Re: New Collections interface - Sized > On Fri, 23 Apr 2021 at 23:07, Brian Goetz wrote: >> >> Is there a compelling

Re: New Collections interface - Sized

2021-04-23 Thread Stephen Colebourne
On Fri, 23 Apr 2021 at 23:07, Brian Goetz wrote: > >> Is there a compelling example of where this would be used by clients? > > Here are some examples: > > https://stackoverflow.com/questions/10988634/java-global-isempty-method > Without passing judgment on the sort of dynamically typed programs t

Re: New Collections interface - Sized

2021-04-23 Thread Brian Goetz
Is there a compelling example of where this would be used by clients? Here are some examples: https://stackoverflow.com/questions/10988634/java-global-isempty-method Without passing judgment on the sort of dynamically typed programs that need a method like this, or wondering what monstrositie

Re: New Collections interface - Sized

2021-04-23 Thread Stephen Colebourne
On Fri, 23 Apr 2021 at 17:08, Brian Goetz wrote: > This has come up before. For example, during an early iteration of the > Stream design, before parallelism entered the picture. The first > scrawled-on-a-napkin prototype for streams was based on Iterator, and it took > about a minute to real

Re: New Collections interface - Sized

2021-04-23 Thread Brian Goetz
This has come up before.  For example, during an early iteration of the Stream design, before parallelism entered the picture.  The first scrawled-on-a-napkin prototype for streams was based on Iterator, and it took about a minute to realize that we could do a much better job if we had a slight

New Collections interface - Sized

2021-04-23 Thread Stephen Colebourne
Hi all, While a discussion on ReversibleCollection is going on, I'd like to raise the interface I've always found most missing from the framework - Sized public interface Sized { int size(); default boolean isEmpty() { return size() == 0; } default boolean isNotEmpty() { ret