4 ms·
It could also be true if the instances were created through auto-boxing (e.g. arrayList.add(10); arrayList.add(10); arrayList.get(0) == array List.get(1) //woul
by tsimionescu 4mo ago
It could also be true if the instances were created through auto-boxing (e.g. arrayList.add(10); arrayList.add(10); arrayList.get(0) == array List.get(1) //would return true, but false if you used 1000 instead of 10).
- papercrane 4mo agoYes, because auto-boxing is just compiling to Integer.getValue under the hood, the bytecode for Integer.getValue(1) and ((Integer) 1) is the same. They'll both compile to something like: iconst_1 invokestatic java/lang/Integer.valueOf:(I)Ljava/lang/Integer
- tsimionescu 4mo agoSure, I was just talking about Java syntax, not the bytecode internals.