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
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one: