net.ontopia.utils
Class SynchronizedCompactHashSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet
          extended by net.ontopia.utils.CompactHashSet
              extended by net.ontopia.utils.SynchronizedCompactHashSet
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set

public class SynchronizedCompactHashSet
extends CompactHashSet

INTERNAL: Extends CompactHashSet to make it synchronized. Saves memory compared with having to wrap the set in a SynchronizedSet.


Constructor Summary
SynchronizedCompactHashSet()
           
SynchronizedCompactHashSet(java.util.Collection c)
           
SynchronizedCompactHashSet(int size)
           
 
Method Summary
 boolean add(java.lang.Object o)
          Adds the specified element to this set if it is not already present.
 boolean addAll(java.util.Collection coll)
           
 void clear()
          Removes all of the elements from this set.
 boolean contains(java.lang.Object o)
          Returns true if this set contains the specified element.
 boolean containsAll(java.util.Collection coll)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isEmpty()
          Returns true if this set contains no elements.
 java.util.Iterator iterator()
          Returns an iterator over the elements in this set.
 boolean remove(java.lang.Object o)
          Removes the specified element from the set.
 boolean removeAll(java.util.Collection coll)
           
 boolean retainAll(java.util.Collection coll)
           
 int size()
          Returns the number of elements in this set (its cardinality).
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class net.ontopia.utils.CompactHashSet
dump
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynchronizedCompactHashSet

public SynchronizedCompactHashSet()

SynchronizedCompactHashSet

public SynchronizedCompactHashSet(java.util.Collection c)

SynchronizedCompactHashSet

public SynchronizedCompactHashSet(int size)
Method Detail

size

public int size()
Description copied from class: CompactHashSet
Returns the number of elements in this set (its cardinality).

Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Overrides:
size in class CompactHashSet

isEmpty

public boolean isEmpty()
Description copied from class: CompactHashSet
Returns true if this set contains no elements.

Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.Set
Overrides:
isEmpty in class CompactHashSet

contains

public boolean contains(java.lang.Object o)
Description copied from class: CompactHashSet
Returns true if this set contains the specified element.

Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class CompactHashSet
Parameters:
o - element whose presence in this set is to be tested.
Returns:
true if this set contains the specified element.

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Overrides:
toArray in class CompactHashSet

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Overrides:
toArray in class CompactHashSet

iterator

public java.util.Iterator iterator()
Description copied from class: CompactHashSet
Returns an iterator over the elements in this set. The elements are returned in no particular order.

Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Overrides:
iterator in class CompactHashSet
Returns:
an Iterator over the elements in this set.
See Also:
ConcurrentModificationException

add

public boolean add(java.lang.Object o)
Description copied from class: CompactHashSet
Adds the specified element to this set if it is not already present.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class CompactHashSet
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(java.lang.Object o)
Description copied from class: CompactHashSet
Removes the specified element from the set.

Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class CompactHashSet

containsAll

public boolean containsAll(java.util.Collection coll)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.Set
Overrides:
containsAll in class java.util.AbstractCollection

addAll

public boolean addAll(java.util.Collection coll)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Overrides:
addAll in class java.util.AbstractCollection

removeAll

public boolean removeAll(java.util.Collection coll)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set
Overrides:
removeAll in class java.util.AbstractSet

retainAll

public boolean retainAll(java.util.Collection coll)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set
Overrides:
retainAll in class java.util.AbstractCollection

clear

public void clear()
Description copied from class: CompactHashSet
Removes all of the elements from this set.

Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class CompactHashSet

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Overrides:
equals in class java.util.AbstractSet

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class java.util.AbstractSet


Copyright © 2000-2009 Ontopia.