Loose ends: Optional
forax at univ-mlv.fr
Mon Jun 3 15:02:24 PDT 2013
On 06/03/2013 07:03 PM, Joe Bowbeer wrote:
> On Mon, Jun 3, 2013 at 3:05 AM, Remi Forax <forax at univ-mlv.fr
> <mailto:forax at univ-mlv.fr>> wrote:
> On 06/03/2013 08:11 AM, Joe Bowbeer wrote:
> I'd like to see a compare-and-contrast between what is
> proposed for Java8 and Guava's Optional and Scala's Option.
> Is the criticism that Brian is fielding now a replay of prior
> criticism of Guava's Optional?
> How have Guava's user been dealing with its intentionally more
> limited approach?
> There are also some comments in the comment section of this wiki page:
> The number one criticism seems to be the lack of a method bind
> like in Haskell,
> but because Java is not Haskell, the exact operation needed is
> neither a map nor a flatMap,
> it's a composition of flatMap and Optional.ofNullable().
> So the issue is more how to deal with the return value of a method
> that can be null but that doesn't return an Optional.
> I still think and this is the conclusion of one of the blog cited
> above that the elvis syntax (?.)
> is the best way to deal with this issue.
> I don't see how to solve this issue without introducing
> Optional.ofNullable(), BTW.
> I agree that the elvis operator seems to handle this well (based on
> some limited experience).
> Does everyone agree that Fugue's Option is an improvement on Guava's
> Jed Wesley-Smith et al's library also includes Either and Pair.
> https://bitbucket.org/atlassian/fugue (Is the javadoc online anywhere?)
> You can see them all in action here:
More information about the lambda-libs-spec-experts