Wait this is confusing for anyone beyond a fresh-faced junior dev? An Integer is an object while 100 is a primitive. Of course two different objects aren't going to be equal since they're literally not the same object. Two primitives of the same value will be though because they are the same primitive. It's exactly the same behavior across many languages.
This right here is why it's critical to have developers of all levels across a team. Those of use who have been doing this long enough don't remember what caused us issues as juniors. We need the mid-levels to translate and remind us of these things lol
It's confusing because using 100 works fine; both are seen as the same object. But using a number over 256 causes it to fail to see both as the same object. Of course, as an experienced dev, I would never use "is" for comparing integers, only for comparing things I know are objects that may otherwise be equal in value.
This right here is why it's critical to have developers of all levels across a team. Those of use who have been doing this long enough don't remember what caused us issues as juniors. We need the mid-levels to translate and remind us of these things lol