15-12-2008, 07:49 PM
Si tu regardes dans l'API de Java, ça peut te donner une idée. Tu peux définir une méthode de comparaison.
Citation :contains
public boolean contains(Object o)
Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)).
This implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element.
Specified by:
contains in interface Collection<E>
Parameters:
o - object to be checked for containment in this collection.
Returns:
true if this collection contains the specified element.