- Set is a child interface of Collection Interface
- Set Interface and HashSet class came into picture in java 1.2 version and LinkedHashSet class was added into collections in java 1.4 version
Features of Set, When to go for Set?
- Duplicates are not allowed.
- Insertion order is not preserved.
public interface Set<E> extends Collection<E> { }
Implementation classes of Set interface are :
- HashSet
- LinkedHashSet extends HashSet
Methods of Set Interface
- Set Interface does not have any new methods, we have to use only collection interface methods
Detailed Digram