This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Luigi Plinge wrote:Yep, but doesn't contains just return true if the object *is* the one specified, not just equal to it?
If you read the API, it says "Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)). "
So, it depends on the specific implementation of the equals() method for the objects in question.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors