3 ms·
Actually, "new Integer()" is guaranteed to always return a new, distinct object. The caching only comes into play during autoboxing conversions, or when you cal
by teraflop 15y ago
Actually, "new Integer()" is guaranteed to always return a new, distinct object. The caching only comes into play during autoboxing conversions, or when you call Integer.valueOf().
- tsotha 15y agoAh, you're right. I was thinking of autoboxing, i.e. Integer a; Integer b; a = 10; b = 10; a == b; // true a = 1000; b = 1000; a == b; // false