Fallback Mechanism With Streams
The Problem I would like to summarize Person objects. Use the lastName if it is not null; if null, then use the firstName; else use the birthDay. If all these are null , then use the default text UNKNOWN. Usually, you write something like this: String summary = ""; if(p.getLastName() != null){ summary = p.getLastName(); } else if(p.getFirstName() != null){ summary = p.getFirstName(); } else if (p.getBirthDate() != null){ summary = p....