You might want to use the Collection implementation instead of a flat array.
The Collection interface defines a contains(Object o) method that returns true / false .
ArrayList implementation defines indexOf(Object o) , which gives an index, but this method does not apply to all implementations of the collection.
Both of these methods require proper implementations of the equals() method, and you probably need a properly implemented hashCode() method if you use a Collection based hash (e.g. HashSet ).
hvgotcodes Aug 02 '10 at 0:00 2010-08-02 00:00
source share