Openfire 3.3.2 Javadoc

org.jivesoftware.util
Class ConcurrentHashSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by org.jivesoftware.util.ConcurrentHashSet<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>

public class ConcurrentHashSet<E>
extends AbstractSet<E>
implements Set<E>, Cloneable, Serializable

This class implements the Set interface, backed by a ConcurrentHashMap instance.

Author:
Matt Tucker
See Also:
Serialized Form

Constructor Summary
ConcurrentHashSet()
          Constructs a new, empty set; the backing ConcurrentHashMap instance has default initial capacity (16) and load factor (0.75).
ConcurrentHashSet(Collection<? extends E> c)
          Constructs a new set containing the elements in the specified collection.
ConcurrentHashSet(int initialCapacity)
          Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor, which is 0.75.
ConcurrentHashSet(int initialCapacity, float loadFactor)
          Constructs a new, empty set; the backing ConcurrentHashMap instance has the specified initial capacity and the specified load factor.
 
Method Summary
 boolean add(E o)
           
 void clear()
           
 Object clone()
           
 boolean contains(Object o)
           
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 boolean remove(Object o)
           
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ConcurrentHashSet

public ConcurrentHashSet()
Constructs a new, empty set; the backing ConcurrentHashMap instance has default initial capacity (16) and load factor (0.75).


ConcurrentHashSet

public ConcurrentHashSet(Collection<? extends E> c)
Constructs a new set containing the elements in the specified collection. The ConcurrentHashMap is created with default load factor (0.75) and an initial capacity sufficient to contain the elements in the specified collection.

Parameters:
c - the collection whose elements are to be placed into this set.
Throws:
NullPointerException - if the specified collection is null.

ConcurrentHashSet

public ConcurrentHashSet(int initialCapacity,
                         float loadFactor)
Constructs a new, empty set; the backing ConcurrentHashMap instance has the specified initial capacity and the specified load factor.

Parameters:
initialCapacity - the initial capacity of the hash map.
loadFactor - the load factor of the hash map.
Throws:
IllegalArgumentException - if the initial capacity is less than zero, or if the load factor is nonpositive.

ConcurrentHashSet

public ConcurrentHashSet(int initialCapacity)
Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor, which is 0.75.

Parameters:
initialCapacity - the initial capacity of the hash table.
Throws:
IllegalArgumentException - if the initial capacity is less than zero.
Method Detail

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Specified by:
iterator in class AbstractCollection<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>
Specified by:
size in class AbstractCollection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>
Overrides:
isEmpty in class AbstractCollection<E>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>
Overrides:
contains in class AbstractCollection<E>

add

public boolean add(E o)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Overrides:
add in class AbstractCollection<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class AbstractCollection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Overrides:
clear in class AbstractCollection<E>

clone

public Object clone()
Overrides:
clone in class Object

Openfire 3.3.2 Javadoc

Copyright © 2003-2007 Jive Software.