Name: rmT116609 Date: 10/30/2001 The description of the java.util.ArrayList.contains(Object o) method is: "Returns true if this list contains the specified element" This would seem to imply that true will be returned if and only if the ArrayList contains an object e such that o and e refer to the same object, but from the description of the methods it implements/overrides and from testing it is clear that it the condition is actually (o==null ? e==null : o.equals(e)). In order to increase clarity I think the description for ArrayList.contains (and possibly other methods) should specify that the equals method is used for object comparision, perhaps along the same line as in java.util.List.contains: "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))." or less formally: "Returns true if this list contains the specified element, testing for equality using the equals method." (Review ID: 134645) ======================================================================
|