org.eclipse.core.internal.utils
Class KeyedHashSet

java.lang.Object
  extended by org.eclipse.core.internal.utils.KeyedHashSet

public class KeyedHashSet
extends java.lang.Object

Adapted from a homonym class in org.eclipse.osgi. A hash table of KeyedElements.


Nested Class Summary
static interface KeyedHashSet.KeyedElement
           
 
Constructor Summary
KeyedHashSet(int capacity)
           
KeyedHashSet(int capacity, boolean replace)
           
 
Method Summary
 boolean add(KeyedHashSet.KeyedElement element)
          Adds an element to this set.
 void clear()
           
 KeyedHashSet.KeyedElement getByKey(java.lang.Object key)
          Returns the set element with the given id, or null if not found.
 boolean remove(KeyedHashSet.KeyedElement toRemove)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyedHashSet

public KeyedHashSet(int capacity)

KeyedHashSet

public KeyedHashSet(int capacity,
                    boolean replace)
Method Detail

add

public boolean add(KeyedHashSet.KeyedElement element)
Adds an element to this set. If an element with the same key already exists, replaces it depending on the replace flag.

Returns:
true if the element was added/stored, false otherwise

clear

public void clear()

getByKey

public KeyedHashSet.KeyedElement getByKey(java.lang.Object key)
Returns the set element with the given id, or null if not found.


remove

public boolean remove(KeyedHashSet.KeyedElement toRemove)

size

public int size()

toString

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