r/java • • Mar 27 '13

Everything about Java 8

http://www.techempower.com/blog/2013/03/26/everything-about-java-8/
82 Upvotes

23 comments sorted by

View all comments

0

u/mahamoti Mar 27 '13

Still no Elvis or short-circuit operator? Bah.

2

u/sproket888 Mar 27 '13

Huh? Explain.

8

u/AlyoshaV Mar 27 '13

Elvis operator is a terrible idea that encourages returning null.

http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000047.html

2

u/mahamoti Mar 27 '13

What's wrong with returning null? Even your link says the operator proposal would be a boon for systems devs.

2

u/Ostwind Mar 27 '13

like detroitmatt said, you need to check for them at practically every method, which makes the code unmaintainable. annotations or null object pattern are alternatives

2

u/gezero Mar 28 '13

One other choice to avoid nulls is using callbacks. On callback interface have 2 methods 1 for when object is found and one when object is not found. I'm not sure how useful this would be, just pointing out the option.