GigaSpaces XAP 7.0 API

org.openspaces.core.util
Class ConcurrentHashSet<E>

java.lang.Object
  extended by org.openspaces.core.util.ConcurrentHashSet<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class ConcurrentHashSet<E>
extends Object
implements Set<E>

Author:
kimchy

Constructor Summary
ConcurrentHashSet()
          Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).
 
Method Summary
 boolean add(E o)
          Adds the specified element to this set if it is not already present.
 boolean addAll(Collection<? extends E> c)
           
 void clear()
          Removes all of the elements from this set.
 boolean contains(Object o)
          Returns true if this set contains the specified element.
 boolean containsAll(Collection<?> c)
           
 boolean isEmpty()
          Returns true if this set contains no elements.
 Iterator<E> iterator()
          Returns an iterator over the elements in this set.
 boolean remove(Object o)
          Removes the specified element from this set if it is present.
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
          Returns the number of elements in this set (its cardinality).
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

ConcurrentHashSet

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

Method Detail

iterator

public Iterator<E> iterator()
Returns an iterator over the elements in this set. The elements are returned in no particular order.

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Returns:
an Iterator over the elements in this set.

size

public int size()
Returns the number of elements in this set (its cardinality).

Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>
Returns:
the number of elements in this set (its cardinality).

isEmpty

public boolean isEmpty()
Returns true if this set contains no elements.

Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>
Returns:
true if this set contains no elements.

contains

public boolean contains(Object o)
Returns true if this set contains the specified element.

Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>
Parameters:
o - element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element.

add

public boolean add(E o)
Adds the specified element to this set if it is not already present.

Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Parameters:
o - element to be added to this set.
Returns:
true if the set did not already contain the specified element.

remove

public boolean remove(Object o)
Removes the specified element from this set if it is present.

Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Parameters:
o - object to be removed from this set, if present.
Returns:
true if the set contained the specified element.

clear

public void clear()
Removes all of the elements from this set.

Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.