As of Java 1.6, both Identity Hash Map and Enum Map did so.
When iterating through such a Map, the Entry value is only valid until you advance to the next iteration.
If possible, rewrite the code so that the Random object is created once and saved, and each time a new random number is required invoke a method on the existing Random object to obtain it.
If it is important that the generated Random numbers not be guessable, you not create a new Random for each random number; the values are too easily guessable.
You should strongly consider using a java.security.
Secure Random instead (and avoid allocating a new Secure Random for each random number needed). Requiring callers to pass only String constants or interned strings to a method is unnecessarily fragile, and rarely leads to measurable performance gains. This equals method is checking to see if the argument is some incompatible type (i.e., a class that is neither a supertype nor subtype of the class that defines the equals method).
If you want to remove all elements from a collection . For example, the Foo class might have an equals method that looks like: This is considered bad practice, as it makes it very hard to implement an equals method that is symmetric and transitive.
Invoking shuts down the entire Java virtual machine. Such calls make it hard or impossible for your code to be invoked by other code. Without those properties, very unexpected behavoirs are possible. Generally, the value of compare To should return zero if and only if equals returns true.
If this is violated, weird and unpredictable failures will occur in classes such as Priority Queue.
In Java 5 the Priority Queue.remove method uses the compare To method, while in Java 6 it uses the equals method.
Using bit arithmetic and then comparing with the greater than operator can lead to unexpected results (of course depending on the value of SWT. = 0' instead of ' Class implements Cloneable but does not define or use the clone method.