Skip to content

Most visited

Recently visited

navigation
Added in API level 1

LinkedHashSet

public class LinkedHashSet
extends HashSet<E> implements Set<E>, Cloneable, Serializable

java.lang.Object
   ↳ java.util.AbstractCollection<E>
     ↳ java.util.AbstractSet<E>
       ↳ java.util.HashSet<E>
         ↳ java.util.LinkedHashSet<E>


LinkedHashSet is a variant of HashSet. Its entries are kept in a doubly-linked list. The iteration order is the order in which entries were inserted.

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 synchronizedSet(Set).

Summary

Public constructors

LinkedHashSet()

Constructs a new empty instance of LinkedHashSet.

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.

LinkedHashSet(Collection<? extends E> collection)

Constructs a new instance of LinkedHashSet containing the unique elements in the specified collection.

Inherited methods

From class java.util.HashSet
From class java.util.AbstractSet
From class java.util.AbstractCollection
From class java.lang.Object
From interface java.util.Set
From interface java.util.Collection
From interface java.lang.Iterable

Public constructors

LinkedHashSet

Added in API level 1
LinkedHashSet ()

Constructs a new empty instance of LinkedHashSet.

LinkedHashSet

Added in API level 1
LinkedHashSet (int capacity)

Constructs a new instance of LinkedHashSet with the specified capacity.

Parameters
capacity int: the initial capacity of this LinkedHashSet.

LinkedHashSet

Added in API level 1
LinkedHashSet (int capacity, 
                float loadFactor)

Constructs a new instance of LinkedHashSet with the specified capacity and load factor.

Parameters
capacity int: the initial capacity.
loadFactor float: the initial load factor.

LinkedHashSet

Added in API level 1
LinkedHashSet (Collection<? extends E> collection)

Constructs a new instance of LinkedHashSet containing the unique elements in the specified collection.

Parameters
collection Collection: the collection of elements to add.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.