Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-07-01 Thread Abraham Marín Pérez
> On 27 Jun 2019, at 22:38, Stuart Marks wrote: > > > > On 6/19/19 12:51 AM, Abraham Marín Pérez wrote: >> private void decorate(Map data) { >> //... >> data.computeIfPresent("field", (k, v) -> highlightDifferences(v, >> otherValue)); >> //... >> } >> At one point an emptyMap()

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-27 Thread Stuart Marks
On 6/19/19 12:51 AM, Abraham Marín Pérez wrote: private void decorate(Map data) { //... data.computeIfPresent("field", (k, v) -> highlightDifferences(v, otherValue)); //... } At one point an emptyMap() was passed to this method, causing an UOE. [...] On the face of it, the

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-24 Thread Abraham Marin-Perez
> > Kind regards, > > Anthony > > > -- > *From:* core-libs-dev on behalf > of Abraham Marín Pérez > *Sent:* Wednesday, June 19, 2019 9:51:46 AM > *To:* Roger Riggs > *Cc:* core-libs-dev@openjdk.java.net > *Subject:* Re: Suggestio

RE: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-19 Thread Anthony Vanelverdinghe
From: core-libs-dev on behalf of Abraham Marín Pérez Sent: Wednesday, June 19, 2019 9:51:46 AM To: Roger Riggs Cc: core-libs-dev@openjdk.java.net Subject: Re: Suggestion for a more sensible implementation of EMPTY_MAP Hi Stuart, Roger, First of all, thank you for such a detailed response

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-19 Thread Abraham Marín Pérez
Hi Stuart, Roger, First of all, thank you for such a detailed response, this really shows the big picture. I guess no implementation will be perfect, there will always be some wrinkles that we need to accept, and the most suitable implementation will be the one with the fewest or least

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-14 Thread Roger Riggs
Hi Stuart, Not withstanding all the details. It would be useful (and possibly expected) that an EMPTY_MAP could be substituted for a Map with no entries.  As it stands, the caller needs know whether any optional possibly modifying operations will be used and decide whether to create an empty

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-13 Thread Stuart Marks
On 6/10/19 7:34 AM, Abraham Marín Pérez wrote: I agree that it makes sense for EMPTY_MAP to have the same logic as Map.of() or unmodifiable(new HashMap()), which means that my suggestion cannot be applied to just EMPTY_MAP... but maybe that’s ok: maybe we can change all of them? If we keep

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-10 Thread Abraham Marín Pérez
Hi Michael, Many thanks for your reply, I can definitely see your point. I agree that it makes sense for EMPTY_MAP to have the same logic as Map.of() or unmodifiable(new HashMap()), which means that my suggestion cannot be applied to just EMPTY_MAP... but maybe that’s ok: maybe we can change

Re: Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-10 Thread Michael Rasmussen
> If I understand correctly, this class represents an immutable empty map. As > a result, operations like put or remove have been implemented to throw > UnsupportedOperationException; this makes sense to me. However, this is > also the implementation for computeIfPresent, which I believe may be

Suggestion for a more sensible implementation of EMPTY_MAP

2019-06-07 Thread Abraham Marin-Perez
Hi everyone, I'm a first timer here, I just joined the group as suggested by Martijn Verburg to make a suggestion for a slight change in the implementation of Collections.EMPTY_MAP. If I understand correctly, this class represents an immutable empty map. As a result, operations like put or