Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

LinkedHashSet

extends HashSet <E>
implements Serializable Cloneable Set <E>
java.lang.Object
   ↳ java.util.AbstractCollection <E>
     ↳ java.util.AbstractSet <E>
       ↳ java.util.HashSet <E>
         ↳ java.util.LinkedHashSet<E>

Class Overview

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.
[Expand]
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.lang.Iterable
From interface java.util.Collection
From interface java.util.Set

Public Constructors

public LinkedHashSet ()

Added in API level 1

Constructs a new empty instance of LinkedHashSet .

public LinkedHashSet (int capacity)

Added in API level 1

Constructs a new instance of LinkedHashSet with the specified capacity.

Parameters
capacity the initial capacity of this LinkedHashSet .

public LinkedHashSet (int capacity, float loadFactor)

Added in API level 1

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

Parameters
capacity the initial capacity.
loadFactor the initial load factor.
)">

public LinkedHashSet ( Collection <? extends E> collection)

Added in API level 1

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

Parameters
collection the collection of elements to add.