News

The Java compiler uses this specification to ensure that you do not accidentally insert an incompatible object into the collection, thus reducing bugs and improving code readability.
One of the nasty little traps a Java developer can run into occurs when Collection.contains(Object) is not used with appropriate understanding. I demonstrate this potential trap in this post.