What's Java's number one problem? If you said "efficiency," then you win! Why do we still use C and C++? If you said "efficiency," then you also win! And so... yesterday, we learned about templates and generics and so forth, and I was able to ask a question that's been bugging me for quite some time. "When you declare an ArrayList<Integer>, are Integer Objects being stored internally, or are primitive ints being stored?" Prior to yesterday, I had given this quite a bit of thought, actually. I'd say about a year ago, I determined that since the classes like Integer, Byte, Float were final, non-inheritable classes, that Java could actually optimize the language by artificially storing primitive ints, auto-unboxing and auto-boxing them, as appropriate. But, as it turned out, I was wrong! Java does not do that. Instead, when you store a bunch of "primitive ints" in an ArrayList<I...
Blog about science and technology, especially software development and space ships. ;) Blake is a software developer who specializes in building inventory management and project management solutions for small or mid-sized businesses. He also spends a fair amount of time on embedded software and database research.