RE: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-19 Thread Timo Kinnunen
left wondering how much utility is in a truly immutable List that no-one else can freely share trusting it to be immutable. Having to sprinkle some List.ensureImmutable(immaybemutableList) method calls everywhere would be pretty bad. Sent from Mail for Windows 10 From: Peter Levart S

RE: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-19 Thread Timo Kinnunen
. Sent from Mail for Windows 10 From: Stuart Marks Sent: Monday, October 19, 2015 03:13 To: joe darcy;Andrew Haley Cc: core-libs-dev Subject: Re: RFC: draft API for JEP 269 Convenience Collection Factories On 10/18/15 10:45 AM, joe darcy wrote: > On 10/17/2015 10:10 AM, Andrew Haley wrote: >&

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-18 Thread Stuart Marks
On 10/18/15 10:45 AM, joe darcy wrote: On 10/17/2015 10:10 AM, Andrew Haley wrote: On 10/17/2015 05:46 PM, Stuart Marks wrote: (I view calling an "inherited" class static method to be poor coding style, but neither javac nor NetBeans warns about it.) That surely can be fixed. Should we start

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-18 Thread Peter Levart
On 10/17/2015 06:46 PM, Stuart Marks wrote: On 10/10/15 6:55 AM, Remi Forax wrote: There is an issue with LinkedHashMap (resp LinkedHashSet), it inherits from HashMap /facepalm/, and static methods are accessible through class inheritance /facepalm/. So if LinkedHashMap doesn't declare

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-18 Thread joe darcy
On 10/17/2015 10:10 AM, Andrew Haley wrote: On 10/17/2015 05:46 PM, Stuart Marks wrote: (I view calling an "inherited" class static method to be poor coding style, but neither javac nor NetBeans warns about it.) That surely can be fixed. Should we start a feature request? I believe

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Ivan Gerasimov
Thank you Stuart for yours comments! On 17.10.2015 20:23, Stuart Marks wrote: On 10/14/15 5:56 AM, Ivan Gerasimov wrote: Map m1 = MyCollections. ofKeys( 1, 2, 3, 4, 5) .vals( 'a', 'b', 'c', 'd', 'e');

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Stuart Marks
On 10/10/15 6:55 AM, Remi Forax wrote: There is an issue with LinkedHashMap (resp LinkedHashSet), it inherits from HashMap /facepalm/, and static methods are accessible through class inheritance /facepalm/. So if LinkedHashMap doesn't declare some methods of(), LinkedHashMap.of("foo") will

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Andrew Haley
On 10/17/2015 05:46 PM, Stuart Marks wrote: > (I view calling an "inherited" class static method to be poor coding style, > but > neither javac nor NetBeans warns about it.) That surely can be fixed. Should we start a feature request? Andrew.

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Andrew Haley
On 10/17/2015 05:46 PM, Stuart Marks wrote: > (I view calling an "inherited" class static method to be poor coding style, > but > neither javac nor NetBeans warns about it.) That surely can be fixed. Should we start a feature request? Andrew.

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Stuart Marks
On 10/14/15 5:56 AM, Ivan Gerasimov wrote: Map m1 = MyCollections. ofKeys( 1, 2, 3, 4, 5) .vals( 'a', 'b', 'c', 'd', 'e'); Yes, we considered a bunch of different alternatives. It looks like you're

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Stephen Colebourne
On 14 October 2015 at 18:56, Kevin Bourrillion wrote: > Note that we have empirically learned through our Lists/Sets/Maps factory > classes that varargs factory methods for mutable collections are almost > entirely useless. Having taken a few days to think it over, I

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-17 Thread Stuart Marks
On 10/14/15 10:56 AM, Kevin Bourrillion wrote: (Sorry that Guava questions were asked and I didn't notice this thread sooner.) Hi Kevin, thanks for this feedback. It's still timely, as it's helping to improve the proposal. Note that we have empirically learned through our Lists/Sets/Maps

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-16 Thread Remi Forax
v@openjdk.java.net> > Envoyé: Mercredi 14 Octobre 2015 22:46:40 > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > On Oct 14, 2015, at 10:56 AM, Kevin Bourrillion <kev...@google.com> wrote: > > Anyway, since we created these methods, they became

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-16 Thread Timo Kinnunen
-- Mail original - > De: "John Rose" > À: "Kevin Bourrillion" > Cc: "core-libs-dev" > Envoyé: Mercredi 14 Octobre 2015 22:46:40 > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > On Oct 14, 2015, at 10:56 AM, K

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-15 Thread Paul Sandoz
> On 15 Oct 2015, at 16:28, Stephen Colebourne wrote: > > I've been working on a Java 8 wrapper class around double[] in my day > job, and added the following factory method: > > /** > * Obtains an instance with entries filled using a function. > * > * The

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-15 Thread Stephen Colebourne
I've been working on a Java 8 wrapper class around double[] in my day job, and added the following factory method: /** * Obtains an instance with entries filled using a function. * * The function is passed the array index and returns the value for that index. * * @param size

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-14 Thread Paul Sandoz
> On 14 Oct 2015, at 06:18, Stuart Marks wrote: > I'm not entirely sure what to take from this. If it were clearly exponential, > we could say with confidence that above a certain threshold there would be > vanishingly little benefit adding more arguments. But since

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-14 Thread John Rose
On Oct 14, 2015, at 10:56 AM, Kevin Bourrillion wrote: > Anyway, since we created these methods, they became an attractive nuisance, > and thousands of users reach for them who would have been better off in > every way using an immutable collection. Our fondest desire is to one

RE: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-14 Thread Timo Kinnunen
. Sent from Mail for Windows 10 From: Kevin Bourrillion Sent: Wednesday, October 14, 2015 19:56 To: Stuart Marks Cc: core-libs-dev Subject: Re: RFC: draft API for JEP 269 Convenience Collection Factories (Sorry that Guava questions were asked and I didn't notice this thread sooner.) Note

RE: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-14 Thread Timo Kinnunen
dows 10 > > > >From: Paul Sandoz >Sent: Wednesday, October 14, 2015 11:38 >Cc: core-libs-dev >Subject: Re: RFC: draft API for JEP 269 Convenience Collection >Factories > > > >> On 14 Oct 2015, at 06:18, Stuart Marks <stuart.ma...@oracle.com> >wrot

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-14 Thread Stephen Colebourne
On 14 October 2015 at 10:38, Paul Sandoz wrote: >> On 14 Oct 2015, at 06:18, Stuart Marks wrote: >> I'm not entirely sure what to take from this. If it were clearly >> exponential, we could say with confidence that above a certain threshold >>

RE: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-14 Thread Timo Kinnunen
mance left on the table. Sent from Mail for Windows 10 From: Paul Sandoz Sent: Wednesday, October 14, 2015 11:38 Cc: core-libs-dev Subject: Re: RFC: draft API for JEP 269 Convenience Collection Factories > On 14 Oct 2015, at 06:18, Stuart Marks <stuart.ma...@oracle.com> wrote: > I'm

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-10 Thread Remi Forax
- Mail original - > De: "Stephen Colebourne" <scolebou...@joda.org> > À: "core-libs-dev" <core-libs-dev@openjdk.java.net> > Envoyé: Vendredi 9 Octobre 2015 15:11:47 > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories &

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-10 Thread Louis Wasserman
t;Stephen Colebourne" <scolebou...@joda.org> > > À: "core-libs-dev" <core-libs-dev@openjdk.java.net> > > Envoyé: Vendredi 9 Octobre 2015 15:11:47 > > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > > &g

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-10 Thread Remi Forax
- Mail original - > De: "Stuart Marks" <stuart.ma...@oracle.com> > À: "Stephen Colebourne" <scolebou...@joda.org> > Cc: "core-libs-dev" <core-libs-dev@openjdk.java.net> > Envoyé: Samedi 10 Octobre 2015 01:11:09 > Objet:

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-09 Thread Stuart Marks
On 10/9/15 6:11 AM, Stephen Colebourne wrote: On 9 October 2015 at 00:39, Stuart Marks wrote: 1. Number of fixed arg overloads. Guava follows this pattern: of(T) of(T, T) of(T, T, T) of(T, T, T, T... elements) whereas the proposal has of(T) of(T, T) of(T, T, T)

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-09 Thread Stuart Marks
On 10/8/15 7:39 PM, Paul Benedict wrote: I don't think the statements "Creates an unmodifiable set containing X elements" is always true. Since sets cannot have duplicates, it's possible passing in X elements gives you less than that based on equality. I think the Set docs should say "...X

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-09 Thread Peter Levart
Hi, On 10/09/2015 04:39 AM, Paul Benedict wrote: I don't think the statements "Creates an unmodifiable set containing X elements" is always true. Since sets cannot have duplicates, it's possible passing in X elements gives you less than that based on equality. I think the Set docs should say

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-09 Thread Stephen Colebourne
On 9 October 2015 at 00:39, Stuart Marks wrote: > 1. Number of fixed arg overloads. Guava follows this pattern: of(T) of(T, T) of(T, T, T) of(T, T, T, T... elements) whereas the proposal has of(T) of(T, T) of(T, T, T) of(T... elements) I'd be interested to know why

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-09 Thread Chris Hegarty
On 09/10/15 13:08, Peter Levart wrote: Hi, On 10/09/2015 04:39 AM, Paul Benedict wrote: I don't think the statements "Creates an unmodifiable set containing X elements" is always true. Since sets cannot have duplicates, it's possible passing in X elements gives you less than that based on

RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-08 Thread Stuart Marks
Hi all, Please review and comment on this draft API for JEP 269, Convenience Collection Factories. For this review I'd like to focus on the API, and set aside implementation issues and discussion for later. JEP: http://openjdk.java.net/jeps/269 javadoc:

Re: RFC: draft API for JEP 269 Convenience Collection Factories

2015-10-08 Thread Paul Benedict
I don't think the statements "Creates an unmodifiable set containing X elements" is always true. Since sets cannot have duplicates, it's possible passing in X elements gives you less than that based on equality. I think the Set docs should say "...X possible elements if unique". Wordsmith