1 hour ago, magicalclick wrote
?? I think Integer is fine? It is essentially
public class Interger
{
int _value;
override operator = .....
}
But, still, Integer is not int. It cost extra pointer in memory. Unless I am wrong? Which no one has yet to explain how Integer is structured.
IMO, Integer[ one billion ] = ( 64bits pointer + 32bits value ) * one billion. Which is absolutly big no no in my previous examples.
And just for me only, I totally don't like to use objects when I can use primitives. Some people can debate this to death, but, I want to use int, that's all that matters.
Java doesn't do operator overloading, so:
public static void doStuff(Integer i) {
i = 5;
}is equivalent to:
public static void doStuff(Integer i) {
i = new Integer(5);
}You're only changing doStuff's reference to i, not changing its actual value (the caller won't see the change). You actually can't do the latter; Integer is immutable in Java.
[edit] And now I remember why I stopped posting. Why in the world does this piece of crap forum dump you back to the first page of a thread when you post?