Optional is a new class introduced in Java 8. However, a very similar class has been available in Guava for quite some time. Optional is a generic class which should be used to represent the concept that a value might be missing. Very often methods that might return a valid object only under some conditions end up returning null in case no valid object could be built. For instance, Map::get returns null in case the key could not be found in the map.