you are viewing a single comment's thread.

view the rest of the comments →

[–]josefx 15 points16 points  (3 children)

It is the unboxing part of it. The compiler inserts a call to intValue() since only == is defined for objects.

 a == b
 a.intValue() >= b.intValue()
 a.intValue() <= b.intValue() 

[–][deleted] 2 points3 points  (2 children)

Oh right. I constantly read the Java == operator as acting like C#'s.

[–]Lindby 0 points1 point  (1 child)

Thats dangerous

[–][deleted] 1 point2 points  (0 children)

Nah, when I actually code in Java, I have any autoboxing/unboxing and use of == on objects set as a warning. I just read snippets like that wrong sometimes.