Autoboxing is Evil Posted on 22. September 2010 by Nicole Rauch Now to be found here. Teilen Sie dies mit:EmailTwitterLike this:Like Loading... Related
Hmm, while your points about autoboxing (and Integers and null values and the definition of equal vs. == and primitives vs Objects) are valid, I don’t agree with the proposed solution.
Autoboxing solves a real problem: Reduction of Code Noise. It does its job. Most of it’s weaknesses are inherited from weaknesses of the language. Don’t blame autoboxing for them.
We might agree: If everybody stops using autoboxing as an excuse to careless (and thoughtless) mix primitives and Integers the java world would be better place.
Good points. You are right: This post is indeed somewhat fundamentalistic. Our aim is to provoke thinking. And yes, it is a language (Java) matter. We have only seen too much code where autoboxing is used thoughtlessly. As always: If you know what you are doing and what the consequences are and you decide to do it this way, it is more than ok; as long as you start complaining about the results.
Have a look at http://stackoverflow.com/questions/3131136/integers-caching-in-java which further shows the problems of boxing/unboxing.
Nevermind, I just understood that you already covered this.