HashSet charSet = new HashSet();
for (char i = 0; i < 100; i++) {
charSet.add(i);
charSet.remove(i - 1);
}
System.out.println(charSet.size());
HashSet intSet = new HashSet();
for (int i = 0; i < 100; i++) {
intSet.add(i);
intSet.remove(i - 1);
}
System.out.println(intSet.size());
Output is 100 and 1 respectively.
I just realized that short and char do no get auto unboxed in Java. Why didn't the designers think it was important to do that?