Comment on Patterns with Rust TypesparentComments−paulddraper3y.valueOf() will sometimes give different instance, sometimes not.If you want a instance, I recommend new :)−monocasa3yWell, 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".−paulddraper3yIDK it makes sense to me.Unless you call `new` there's no guarantee that you have a different object.
Comments
.valueOf() will sometimes give different instance, sometimes not.
If you want a instance, I recommend new :)
Well, unfortunately autoboxong will silently call valueOf(). So
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".
IDK it makes sense to me.
Unless you call `new` there's no guarantee that you have a different object.