valhalla-dev Digest, Vol 6, Issue 3

Brian Goetz brian.goetz at oracle.com
Mon Dec 22 01:18:08 UTC 2014


> Hi,
>
> What happened to Optional?
>
> If Optional could be morphed into a value type AND be specialized at the
> same time, then returning Optional<int> from Map<K, int>.getOptionaly(k)
> would be the right thing to do.

Nothing has happened yet!  But, it is high on the list of nice-to-haves 
to have a path to migrating a value-based reference class to be a value 
type.  Significant challenges exist on this path, but we're going to try 
anyway.

A value-Optional would indeed provide one path forward for 
rehabilitating Map.get.  (The existing getOrDefault is another option.)





More information about the valhalla-dev mailing list