Autoboxing is rather scary. While I fully understand the difference between == and .equals I can\'t but help have the follow bug the hell out of m
When you write
foo.get(0)
the compiler does not matter how you created the List. It only looks at the compile-time type of the List foo. So, if that is a List
System.out.println(foo.get(0).intValue() == bar.get(0).intValue());
not
System.out.println(foo.get(0) == bar.get(0));
because that has a totally different meaning.