Using util package
1 To implement a class to be capable to use hashset, hashcode() and equals(Object o) need to be implemented.
2 Vector has method contains(), to make it work correctly, the equals(Object o) need to be implemented
3 the signature of equals() is boolean equals(Object o), so generally, the first line is to test the instanceof methods.
4 To Collections.sort() , the comparable interface need to be implemented, and implements the int compareTo() method.