Multiple null checks in Java 8
You may do it like so:
String s = Stream.of(str1, str2, str3)
.filter(Objects::nonNull)
.findFirst()
.orElse(str4);
How about ternary conditional operator?
String s =
str1 != null ? str1 :
str2 != null ? str2 :
str3 != null ? str3 : str4
;