Programming Tips - Java: How to prepend (add at the start) of a StringBuffer

Date: 2014mar24 Language: Java Keywords: append Q. Java: How to prepend (add at the start) of a StringBuffer A. Use insert with position zero:
StringBuffer sb = new StringBuffer(); sb.append("World"); sb.insert(0, "Hello "); // <----- prepending