public class LinkedHashSet<E> extends HashSet<E> implements Set<E>
Null elements are allowed, and all the optional Set operations are supported.
Like HashSet, LinkedHashSet is not thread safe, so access by multiple threads
must be synchronized by an external mechanism such as
Collections.synchronizedSet(Set).
| Constructor and Description |
|---|
LinkedHashSet()
Constructs a new empty instance of
LinkedHashSet. |
LinkedHashSet(Collection<? extends E> collection)
Constructs a new instance of
LinkedHashSet containing the unique
elements in the specified collection. |
LinkedHashSet(int capacity)
Constructs a new instance of
LinkedHashSet with the specified
capacity. |
LinkedHashSet(int capacity,
float loadFactor)
Constructs a new instance of
LinkedHashSet with the specified
capacity and load factor. |
add, clear, contains, isEmpty, iterator, remove, sizeequals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringpublic LinkedHashSet()
LinkedHashSet.public LinkedHashSet(int capacity)
LinkedHashSet with the specified
capacity.capacity - the initial capacity of this LinkedHashSet.public LinkedHashSet(int capacity,
float loadFactor)
LinkedHashSet with the specified
capacity and load factor.capacity - the initial capacity.loadFactor - the initial load factor.public LinkedHashSet(Collection<? extends E> collection)
LinkedHashSet containing the unique
elements in the specified collection.collection - the collection of elements to add.