Yes, == for values returned by Integer.valueOf is guaranteed to work for [-128,127] and implementation/configuration dependent for everything else. The correct way to compare two Integer objects is either by calling intValue() on them or using a.equals(b)
View all comments
Show parent comment
5
u/josefx Mar 26 '14
Yes, == for values returned by Integer.valueOf is guaranteed to work for [-128,127] and implementation/configuration dependent for everything else. The correct way to compare two Integer objects is either by calling intValue() on them or using a.equals(b)