A
Set
is a Collection
that cannot contain duplicate elements. Set
models the mathematical set abstraction. The Set
interface contains no methods other than those inherited from Collection
. It adds the restriction that duplicate elements are prohibited. Set
also adds a stronger contract on the behavior of the equals
and hashCode
operations, allowing Set
objects with different implementation types to be compared meaningfully. Two Set
objects are equal if they contain the same elements.Set Interfaces
Set Implementations
- LinkedHashSet
Creating a set that retains the order of insertion - HashSet HashSet class in java
- TreeSet
TreeSet class in java – constructors
Converting ArrayList to HashSet
Operations on Sets
SortedSet
- SortedSet Interface
- SortedSet Operations
- Standard constructors for SortedSet interface
- Range-view operations on SortedSet interface
- Creating a sorted set
No comments:
Post a Comment