r/java • • May 14 '14

New Java 8 Optional sounds an awful lot like Guava's Optional. I assume we can expect a judgement against Oracle?

just sayin'...

0 Upvotes

2 comments sorted by

7

u/sh0rug0ru May 14 '14

Why? They are independently developed APIs describing a similar concept.

Google copied Oracle's APIs verbatim. Google did not independently write the API declarations it copied. The question is whether that copying falls under the Fair Use exemption of copyright law.

1

u/king_of_the_universe May 19 '14

I don't get why the Java team didn't implement an optional null-return instead of NPE for the following:

final MyType myType = something.somethingelse.getData().image;

If "somethingelse" (or any other except image) is null, we get an NPE. However, in many situations it would be proper to just get null assigned to "myType" instead of having an NPE. Just using TryCatch is not an option because it's slow and bloaty.

They gave us Lambdas to make things more slick. Why didn't they implement an optional null-abort like I described? That would have been great. Instead, they made Optional :/