Set

A collection with does not allow duplicates.

Implementations

  • HashSet is the recommended implementation for most cases, but the order can be unpredictable

  • TreeSet allows ordering through a comparator

  • LinkedHashSet keeps the insertion order

Last updated