I want to check for null or empty specifically in my code. Does empty and null are same for StringBuilder in Java?
StringBuilder
For example:
StringBuilde
The below code may help you,
StringBuffer sb = new StringBuffer(); String str = sb.toString(); if(!"".equals(str)) { System.out.println("String : " + str); } else { System.out.println("Empty Builder"); }