I have a Map> in my code, where I\'d avoid potential null pointers if the map\'s #get() method returned an empty l
Map>
#get()
Thanks to default methods, Java 8 now has this built in with Map::getOrDefault:
default
Map map = ... map.put(1, "1"); System.out.println(map.getOrDefault(1, "2")); // "1" System.out.println(map.getOrDefault(2, "2")); // "2"