- The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.
- Set also extends Collection, but it prohibits duplicate items (this is what defines a Set).
- No new methods are introduced; specifically, none for index-based operations (elements of Sets are not ordered).
- Concrete Set implementations contain methods that forbid adding two equal Objects.
- More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element
- Java has two implementations: HashSet, TreeSet
Posted in: