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

2015-10-19 Thread Timo Kinnunen
r their “potential problems” categories. 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/

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

2015-10-19 Thread Timo Kinnunen
; and I'm 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:

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 som

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 java

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'); Yes, we considered a bunch of different

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 factory

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 wrestling a bit with type inference :-), gi

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/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 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 reluctantly think that Kevin

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

2015-10-16 Thread Timo Kinnunen
--- > 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, Kevin Bourrillion wrote

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

2015-10-16 Thread Remi Forax
ample, LinkedHashMap.of() will return a HashMap. so +1 to have methods of() only on interfaces. Rémi - Mail original - > De: "John Rose" > À: "Kevin Bourrillion" > Cc: "core-libs-dev" > Envoyé: Mercredi 14 Octobre 2015 22:46:40 > Objet: Re:

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

2015-10-15 Thread Remi Forax
? Rémi - Mail original - > De: "Stephen Colebourne" > À: "core-libs-dev" > Envoyé: Jeudi 15 Octobre 2015 16:28:00 > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > I've been working on a Java 8 wrapper class around double

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 function is passed the array i

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 the

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

2015-10-14 Thread Timo Kinnunen
gt;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 >wrote: >> I'm not entirely sure what to take from

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.)

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 day > be able to de

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

2015-10-14 Thread Ivan Gerasimov
Hi Stuart! Most of the API is pretty straightforward, with fixed-arg and varargs "of()" factories for List, Set, ArrayList, and HashSet; and with fixed-arg "of()" factories and varargs "ofEntries()" factories for Map and HashMap. Has it been considered to separate a Map creation into two s

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

2015-10-14 Thread Rémi Forax
;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 >wrote: >> I'm not entirely sure what to take from this. If it were clearly &g

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

2015-10-14 Thread Timo Kinnunen
eft 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 wrote: > I'm not entirely sure what to take

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 >> there would be vanishingly little benefit adding mo

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 the curve seems > to flatte

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

2015-10-13 Thread Stuart Marks
On 10/10/15 9:10 AM, Louis Wasserman wrote: If you're asking about why we stopped where we did, we collected actually rather a lot of data on the size of static collection constants using immutable collections, both with builder syntax and without. https://github.com/google/guava/issues/2071#is

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

2015-10-10 Thread Louis Wasserman
olebourne" > > À: "core-libs-dev" > > Envoyé: Vendredi 9 Octobre 2015 15:11:47 > > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > > > On 9 October 2015 at 00:39, Stuart Marks > wrote: > > [...] > > > &g

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

2015-10-10 Thread Remi Forax
- Mail original - > De: "Stephen Colebourne" > À: "core-libs-dev" > Envoyé: Vendredi 9 Octobre 2015 15:11:47 > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > On 9 October 2015 at 00:39, Stuart Marks wrote: [...] >

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

2015-10-10 Thread Remi Forax
- Mail original - > De: "Stuart Marks" > À: "Stephen Colebourne" > Cc: "core-libs-dev" > Envoyé: Samedi 10 Octobre 2015 01:11:09 > Objet: Re: RFC: draft API for JEP 269 Convenience Collection Factories > > > > On 10/9/15 6:

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) of(T... elements) I'd be

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 poss

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 equal

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 Guava did it that way and w

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-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 something

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: http://cr.openjdk.j