Question on layer/peeling
brian.goetz at oracle.com
Tue Jan 6 22:45:20 UTC 2015
> By the way, C# solves this by having TryGet type of methods that return a
> boolean indicating success (I.e. found mapping) and set an out parameter to
> the value found. You'd need a lightweight tuple or multi return to do the
> same in java, I think.
Right, there's two ways to fix get():
- Using the getOrDefault(key, sentinel) // added in Java 8
- Using some sort of optional-like return type
Not quite at that part of the road yet.
More information about the valhalla-dev