net.ontopia.utils
Class SynchronizedCompactHashSet<E>

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

public class SynchronizedCompactHashSet<E>
extends CompactHashSet<E>

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


Field Summary
 
Fields inherited from class net.ontopia.utils.CompactHashSet
deletedObject, elements, freecells, INITIAL_SIZE, LOAD_FACTOR, modCount, nullObject, objects
 
Constructor Summary
SynchronizedCompactHashSet()
           
SynchronizedCompactHashSet(Collection c)
           
SynchronizedCompactHashSet(int size)
           
 
Method Summary
 boolean add(Object o)
          Adds the specified element to this set if it is not already present.
 boolean addAll(Collection coll)
           
 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 coll)
           
 boolean equals(Object o)
           
 int hashCode()
           
 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 the set.
 boolean removeAll(Collection coll)
           
 boolean retainAll(Collection coll)
           
 int size()
          Returns the number of elements in this set (its cardinality).
 Object[] toArray()
           
<E> E[]
toArray(E[] a)
           
 String toString()
           
 
Methods inherited from class net.ontopia.utils.CompactHashSet
dump, rehash, rehash
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynchronizedCompactHashSet

public SynchronizedCompactHashSet()

SynchronizedCompactHashSet

public SynchronizedCompactHashSet(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 Collection<E>
Specified by:
size in interface Set<E>
Overrides:
size in class CompactHashSet<E>

isEmpty

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

Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>
Overrides:
isEmpty in class CompactHashSet<E>

contains

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

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

toArray

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

toArray

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

iterator

public Iterator<E> 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 Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Overrides:
iterator in class CompactHashSet<E>
Returns:
an Iterator over the elements in this set.
See Also:
ConcurrentModificationException

add

public boolean add(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 Collection<E>
Specified by:
add in interface Set<E>
Overrides:
add in class CompactHashSet<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)
Description copied from class: CompactHashSet
Removes the specified element from the set.

Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class CompactHashSet<E>

containsAll

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

addAll

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

removeAll

public boolean removeAll(Collection coll)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>
Overrides:
removeAll in class AbstractSet<E>

retainAll

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

clear

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

Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Overrides:
clear in class CompactHashSet<E>

toString

public String toString()
Overrides:
toString in class AbstractCollection<E>

equals

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

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<E>
Specified by:
hashCode in interface Set<E>
Overrides:
hashCode in class AbstractSet<E>


Copyright © 2000-2012 Ontopia.