Re: [External] : Re: ReversibleCollection proposal

2021-05-20 Thread Peter Levart
On 20/05/2021 08:35, dfranken@gmail.com wrote: I also think the proposal of Stuart is reasonable though, but it seemed to me that we had reached some sort of impasse in this discussion. As Remi points out, we have (default) methods which sometimes throw exceptions when they are implemented

Re: [External] : Re: ReversibleCollection proposal

2021-05-20 Thread dfranken . jdk
Dear Brian, I understand this would be a massive undertaking. Still, the date-time library was a mess before Java 8 and it has been rewritten and found its way to most other libraries. So while I understand this isn't going to be done any time soon, my only question was whether it had been

Re: [External] : Re: ReversibleCollection proposal

2021-05-19 Thread Brian Goetz
Has it ever been conceived to create an entire new API like how it was done for Dates and Times? Obviously this would be a massive undertaking, but it seems to me we've just about reached the limits of how far we can stretch the current API. "This code is a mess, we should throw it away and

Re: [External] : Re: ReversibleCollection proposal

2021-05-14 Thread dfranken . jdk
+0200, fo...@univ-mlv.fr wrote: > - Mail original - > > De: "Anthony Vanelverdinghe" > > À: "Remi Forax" > > Cc: "Stuart Marks" , "core-libs-dev" > > > > Envoyé: Jeudi 13 Mai 2021 21:18:22 >

Re: [External] : Re: ReversibleCollection proposal

2021-05-13 Thread forax
- Mail original - > De: "Anthony Vanelverdinghe" > À: "Remi Forax" > Cc: "Stuart Marks" , "core-libs-dev" > > Envoyé: Jeudi 13 Mai 2021 21:18:22 > Objet: Re: [External] : Re: ReversibleCollection proposal > Hi Rémi >

Re: [External] : Re: ReversibleCollection proposal

2021-05-13 Thread Anthony Vanelverdinghe
Hi Rémi The discussion "new types? or new default methods?" is indeed a valid one. In fact, I think this choice has already been made once in favor of a default method, when adding `List::sort` was chosen over adding `SortedList` (though I imagine that choice was a no-brainer). In this case I

Re: [External] : Re: ReversibleCollection proposal

2021-05-12 Thread Remi Forax
- Mail original - > De: "Peter Levart" > À: "Stuart Marks" > Cc: "core-libs-dev" > Envoyé: Mercredi 12 Mai 2021 08:28:07 > Objet: Re: [External] : Re: ReversibleCollection proposal > On 5/12/21 2:55 AM, Stuart Marks wrote: >> As

Re: [External] : Re: ReversibleCollection proposal

2021-05-12 Thread forax
- Mail original - > De: "Stuart Marks" > À: "Remi Forax" > Cc: "core-libs-dev" > Envoyé: Mercredi 12 Mai 2021 07:27:51 > Objet: Re: [External] : Re: ReversibleCollection proposal >>> I'm certain that uses of RC/RS will be rare i

Re: [External] : Re: ReversibleCollection proposal

2021-05-12 Thread Peter Levart
On 5/12/21 2:55 AM, Stuart Marks wrote: As you point out, add() is kind of like addLast(), except without the reordering semantics for LinkedHashSet. And reversed().add() is a roundabout way of saying addFirst() -- also without the reordering semantics for LinkedHashSet. I think most

Re: [External] : Re: ReversibleCollection proposal

2021-05-11 Thread Stuart Marks
I'm certain that uses of RC/RS will be rare in the beginning, because they will be new, and people won't be familar with them. And then there will the people who say "I can't use them because I'm stuck on JDK 11 / 8 / 7 / 6 " It was the same thing with lambdas and streams in Java 8, with

Re: [External] : Re: ReversibleCollection proposal

2021-05-11 Thread Stuart Marks
On 5/1/21 7:36 AM, Peter Levart wrote: On 4/30/21 9:25 PM, Stuart Marks wrote: So I think we're stuck with void-returning add{First,Last} methods. Have you thought of perhaps not adding them at all? Collection.add() for: List(s) - behaves the same as addLast() LinkedHashSet - behaves

Re: [External] : Re: ReversibleCollection proposal

2021-05-11 Thread forax
- Mail original - > De: "Peter Levart" > À: "Remi Forax" , "dfranken jdk" > Cc: "Stuart Marks" , "core-libs-dev" > > Envoyé: Mardi 11 Mai 2021 13:44:08 > Objet: Re: [External] : Re: ReversibleCollection proposal >

Re: [External] : Re: ReversibleCollection proposal

2021-05-11 Thread Peter Levart
on, 2021-05-10 at 12:22 +0200, fo...@univ-mlv.fr wrote: - Mail original - De: "dfranken jdk" À: "Remi Forax" , "Stuart Marks" Cc: "core-libs-dev" Envoyé: Dimanche 9 Mai 2021 12:13:58 Objet: Re: [External] : Re: ReversibleCollection proposal When I t

Re: [External] : Re: ReversibleCollection proposal

2021-05-11 Thread forax
- Mail original - > De: "dfranken jdk" > À: "Remi Forax" > Cc: "Stuart Marks" , "core-libs-dev" > > Envoyé: Mardi 11 Mai 2021 08:45:15 > Objet: Re: [External] : Re: ReversibleCollection proposal > Dear mr. Forax, Hi Dave,

Re: [External] : Re: ReversibleCollection proposal

2021-05-11 Thread dfranken . jdk
t; - Mail original - > > De: "dfranken jdk" > > À: "Remi Forax" , "Stuart Marks" > > > > Cc: "core-libs-dev" > > Envoyé: Dimanche 9 Mai 2021 12:13:58 > > Objet: Re: [External] : Re: ReversibleCollection proposa

Re: [External] : Re: ReversibleCollection proposal

2021-05-10 Thread forax
- Mail original - > De: "dfranken jdk" > À: "Remi Forax" , "Stuart Marks" > Cc: "core-libs-dev" > Envoyé: Dimanche 9 Mai 2021 12:13:58 > Objet: Re: [External] : Re: ReversibleCollection proposal > When I thought a

Re: [External] : Re: ReversibleCollection proposal

2021-05-09 Thread dfranken . jdk
Forax" > > Cc: "core-libs-dev" > > Envoyé: Mercredi 5 Mai 2021 02:00:03 > > Objet: Re: [External] : Re: ReversibleCollection proposal > > > On 5/1/21 5:57 AM, fo...@univ-mlv.fr wrote: > > > I suppose the performance issue comes from the fact that > >

Re: [External] : Re: ReversibleCollection proposal

2021-05-05 Thread forax
- Mail original - > De: "Stuart Marks" > À: "Remi Forax" > Cc: "core-libs-dev" > Envoyé: Mercredi 5 Mai 2021 02:00:03 > Objet: Re: [External] : Re: ReversibleCollection proposal > On 5/1/21 5:57 AM, fo...@univ-mlv.fr wrote: >&g

Re: [External] : Re: ReversibleCollection proposal

2021-05-04 Thread Stuart Marks
On 5/1/21 5:57 AM, fo...@univ-mlv.fr wrote: I suppose the performance issue comes from the fact that traversing a LinkedHahSet is slow because it's a linked list ? You can replace a LinkedHashSet by a List + Set, the List keeps the values in order, the Set avoids duplicates. Using a

Re: [External] : Re: ReversibleCollection proposal

2021-05-04 Thread Stuart Marks
The line of discussion here was introduced by Remi, who was making an argument of the form "introducing a type cannot solve this particular problem, therefore, introducing a new type is not useful at all." I was providing an example of where the new type is useful as a method parameter. That's

Re: [External] : Re: ReversibleCollection proposal

2021-05-01 Thread Peter Levart
On 4/30/21 9:25 PM, Stuart Marks wrote: So I think we're stuck with void-returning add{First,Last} methods. Have you thought of perhaps not adding them at all? Collection.add() for: List(s) - behaves the same as addLast() LinkedHashSet - behaves the same as addLast() Deque - behaves

Re: [External] : Re: ReversibleCollection proposal

2021-04-30 Thread Stuart Marks
OK, I think we can wrap up this portion of the thread. As the proposal stands, it has add{First,Last} returning void instead of some useful value. For SortedSet and for LinkedHashMap's views, these throw UOE. Can we do better? Collection has add(), Deque has add{First,Last} and

Re: [External] : Re: ReversibleCollection proposal

2021-04-28 Thread Peter Levart
On 4/28/21 7:19 AM, Stuart Marks wrote: On 4/27/21 9:17 AM, Anthony Vanelverdinghe wrote: On Tuesday, April 27, 2021 11:25 CEST, Peter Levart wrote: Now just some of my thoughts about the proposal: - SortedSet.addFirst/.addLast - I think an operation that would be used in situations

Re: [External] : Re: ReversibleCollection proposal

2021-04-28 Thread Henri Tremblay
Hi, (I think the first version of this message never went through, so here it goes just in case) I just read quickly the proposal and it made me think about another common issue. I wonder if we could tackle it as well. I will call it the "find the first element when there is only one" problem.

Re: [External] : Re: ReversibleCollection proposal

2021-04-27 Thread Stuart Marks
On 4/27/21 9:17 AM, Anthony Vanelverdinghe wrote: On Tuesday, April 27, 2021 11:25 CEST, Peter Levart wrote: Now just some of my thoughts about the proposal: - SortedSet.addFirst/.addLast - I think an operation that would be used in situations like: "I know this element should always be

Re: [External] : Re: ReversibleCollection proposal

2021-04-22 Thread forax
- Mail original - > De: "Stuart Marks" > À: "Remi Forax" > Cc: "core-libs-dev" > Envoyé: Mercredi 21 Avril 2021 20:53:25 > Objet: Re: [External] : Re: ReversibleCollection proposal > On 4/19/21 2:01 PM, Remi Forax wrote: >> - M

Re: [External] : Re: ReversibleCollection proposal

2021-04-21 Thread Stuart Marks
On 4/19/21 2:01 PM, Remi Forax wrote: - Mail original - Thinking a little bit about your proposal, introducing an interface right in the middle of a hierarchy is not a backward compatible change (you have an issue when the compiler has to use the lowest upper bound). By example