java string util if empty default

Solutions on MaxInterview for java string util if empty default by the best coders in the world

showing results for - "java string util if empty default"
Leonardo
08 Sep 2017
1String emptyString = new String();    
2result = StringUtils.defaultIfEmpty(emptyString, "default");
3System.out.println(result);
4
5String nullString = null;
6result = StringUtils.defaultIfEmpty(nullString, "default");
7System.out.println(result);