Java Tip of the Week #2 – Optional

Java Optional

Optional was something new introduced in Java 8 that allows you to wrap a value that might be null. By using Optional, you can perform operations to check if a value exists, get the value, return a default if no value exists or do something if it does.

I do find it very useful and I’ve been using it heavily in my last few projects. Check out this small video about it: