public static void main(String[] args) { HashSet set = new HashSet(); set.add(new StringBuffer(\"abc\")); set.add(new StringBuffer(\"abc\")); set.a
Two StringBuffer objects are different objects despite having the same arguments. Therefore HashSet just adds the StringBuffers instead of ignoring duplicates.