FileDocCategorySizeDatePackage
LinkedHashSet.javaAPI DocAndroid 1.5 API3202Wed May 06 22:41:04 BST 2009java.util

LinkedHashSet

public class LinkedHashSet extends HashSet implements Serializable, Set, Cloneable
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 {@link Collections#synchronizedSet(Set)}.

since
Android 1.0

Fields Summary
private static final long
serialVersionUID
Constructors Summary
public LinkedHashSet()
Constructs a new empty instance of {@code LinkedHashSet}.

since
Android 1.0


                     
      
        super(new LinkedHashMap<E, HashSet<E>>());
    
public LinkedHashSet(int capacity)
Constructs a new instance of {@code LinkedHashSet} with the specified capacity.

param
capacity the initial capacity of this {@code LinkedHashSet}.
since
Android 1.0

        super(new LinkedHashMap<E, HashSet<E>>(capacity));
    
public LinkedHashSet(int capacity, float loadFactor)
Constructs a new instance of {@code LinkedHashSet} with the specified capacity and load factor.

param
capacity the initial capacity.
param
loadFactor the initial load factor.
since
Android 1.0

        super(new LinkedHashMap<E, HashSet<E>>(capacity, loadFactor));
    
public LinkedHashSet(Collection collection)
Constructs a new instance of {@code LinkedHashSet} containing the unique elements in the specified collection.

param
collection the collection of elements to add.
since
Android 1.0

        super(new LinkedHashMap<E, HashSet<E>>(collection.size() < 6 ? 11
                : collection.size() * 2));
        for (E e : collection) {
            add(e);
        }
    
Methods Summary
java.util.HashMapcreateBackingMap(int capacity, float loadFactor)

        return new LinkedHashMap<E, HashSet<E>>(capacity, loadFactor);