It works EXACTLY as I would expect. LinkedList has a remove(int) method and that is what is and should be called. The only people that would be bitten are those that don’t read the docs or don’t use an IDE that would show them exactly what method they are calling.
Again it works as expected. == compares object references so naturally there isn’t really any reason to expect the comparison above to evaluate to true. Anyone that programs in Java knows enough to use the Object.equals(Object) method instead.
Those knowing a bit more will recall that Integer objects are immutable and so the optimization of returning the same instance for a few common values (in this case small numbers like ‘2’) are a valid optimization that is present in the current implementation.
Yes, that indeed looks scary.
[quote]Yes, new Java version is a bastard one and not all marketing hype Sun is employing to say cleaner, safer Java hides the truth: the baby is ugly!
[/quote]
The baby is more complicated than it was before. Try adding features without becoming more complicated. Let me know when you’ve figured it out.
If generics confuse you, avoid them. You can use C++ without templates too. I’m not saying that things couldn’t be better. I’m just saying that the situation is far from the dire state of affairs that this thread seems to indicate.