Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-28 Thread Kevin Bourrillion
I do NOT wish to restart this discussion; I just noticed a falsehood that was never exposed: On Wed, Mar 6, 2013 at 1:47 AM, Remi Forax fo...@univ-mlv.fr wrote: Google's Guava, which is a popular library, defines a class named Optional, but allow to store null unlike the current proposed

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-08 Thread Mike Duigou
On Mar 5 2013, at 07:12 , Alan Bateman wrote: Just a couple of small things. Will the docs build complain about the unknown taglets? (@apiNote, @implNote ...) It currently issues a warning. I have a Javadoc.gmk patch which I am pursuing separately to enable recognition of these tags.

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-08 Thread Louis Wasserman
IIRC, there have already been centithreads discussing Optional; I don't think the final decision is likely to change at this point. On Fri, Mar 8, 2013 at 12:26 PM, Mike Duigou mike.dui...@oracle.com wrote: On Mar 5 2013, at 07:12 , Alan Bateman wrote: Just a couple of small things.

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-06 Thread Remi Forax
Ok, let be nuclear on this, There is no good reason to introduce OptionalT in java.util. It doen't work like Google's Guava Optional despite having the same name, it doesn't work like Scala's Option despite having a similar name, moreover the lambda pipeline face a similar issue with the

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-06 Thread Remi Forax
On 03/06/2013 11:54 AM, Jed Wesley-Smith wrote: Really, this is a lot of fuss over nothing. There is actually no fundamental difference between Scala's Option, Guava's Optional, Fugue's Option, Java's Optional and Haskell's Maybe – they are modelling the same thing, the possibility of a value

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-06 Thread Zhong Yu
Just another idea: findFirst() throws NoSuchElementException if the stream is empty. Add an intermediary operation that maps an empty stream to a non-empty one StreamT ifEmpty(T item); so we can say stream.ifEmpty(null).findFirst(); stream.ifEmpty(0).reduce(sum);

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-06 Thread Jack Moxley
[mailto:core-libs-dev@openjdk.java.net] Sent: Wed, 06 Mar 2013 11:58:43 + Subject: Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong On 03/06/2013 11:54 AM, Jed Wesley-Smith wrote: Really, this is a lot of fuss over nothing. There is actually no fundamental

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-06 Thread Jed Wesley-Smith
There is no need for an Option container to show how nested collections may be misused, you could just as easily show an example of a ListListListT that is isomorphic to a flattened IterableT . I'd simply point to the utility of the monadic bind or flatMap function! There are several reasons

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-06 Thread Jed Wesley-Smith
Really, this is a lot of fuss over nothing. There is actually no fundamental difference between Scala's Option, Guava's Optional, Fugue's Option, Java's Optional and Haskell's Maybe – they are modelling the same thing, the possibility of a value not being present. The fact that there may be

Re: RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-05 Thread Alan Bateman
On 04/03/2013 20:29, Mike Duigou wrote: Hello All; This patch introduces Optional container objects to be used by the lambda streams libraries for returning results. The reference Optional type, as defined, intentionally does not allow null values. null may be used with the Optional.orElse()

RFR : JDK-8001642 : Add OptionalT, OptionalDouble, OptionalInt, OptionalLong

2013-03-04 Thread Mike Duigou
Hello All; This patch introduces Optional container objects to be used by the lambda streams libraries for returning results. The reference Optional type, as defined, intentionally does not allow null values. null may be used with the Optional.orElse() method. All of the Optional types define