Hacker News new | ask | show | jobs
by monocasa 1017 days ago
Well, unfortunately autoboxong will silently call valueOf(). So

    Integer val1 = 5;
    Integer val2 = 5;
    Integer val3 = 200;
    Integer val4 = 200;
will have you ending up with val1 and val2 being equal with ==, but val3 and val4 won't be.

The general reply is 'you're holding it wrong', but that doesn't make it any less absurd. That's what the PHPers say about "123" < "456A" < "78" < "123".

1 comments

IDK it makes sense to me.

Unless you call `new` there's no guarantee that you have a different object.