chrriis.uihierarchy.compatibility
Class HashSet

java.lang.Object
  extended bychrriis.uihierarchy.compatibility.HashSet
All Implemented Interfaces:
Collection, Set

public class HashSet
extends Object
implements Set

The HashSet compatible version.

Version:
1.0 2004.01.11
Author:
Christopher Deckers (chrriis@brainlex.com)

Constructor Summary
HashSet()
          Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).
HashSet(int initialCapacity)
          Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor, which is 0.75.
 
Method Summary
 boolean add(Object o)
          Adds the specified element to this set if it is not already present (optional operation).
 boolean addAll(Collection c)
          Adds all of the elements in the specified collection to this set if they're not already present (optional operation).
 boolean contains(Object o)
          Returns true if this collection contains the specified element.
 boolean isEmpty()
          Returns true if this list contains no elements.
 boolean remove(Object o)
          Removes the first occurrence in this list of the specified element (optional operation).
 boolean removeAll(Collection c)
          Removes all this collection's elements that are also contained in the specified collection (optional operation).
 int size()
          Returns the number of elements in this list.
 Object[] toArray()
          Returns an array containing all of the elements in this collection.
 Object[] toArray(Object[] a)
          Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashSet

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


HashSet

public HashSet(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.
Method Detail

toArray

public Object[] toArray()
Returns an array containing all of the elements in this collection.

Specified by:
toArray in interface Collection
Returns:
The array.

toArray

public Object[] toArray(Object[] a)
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

Specified by:
toArray in interface Collection
Parameters:
a - The array from which to get the type.
Returns:
The array.

contains

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

Specified by:
contains in interface Collection
Parameters:
o - The object to look for.
Returns:
True if found.

add

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

Specified by:
add in interface Collection
Parameters:
o - The object to add.
Returns:
True if changed.

addAll

public boolean addAll(Collection c)
Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Specified by:
addAll in interface Collection
Parameters:
c - The collection.
Returns:
True if changed.

size

public int size()
Returns the number of elements in this list.

Specified by:
size in interface Collection
Returns:
The size.

remove

public boolean remove(Object o)
Removes the first occurrence in this list of the specified element (optional operation).

Specified by:
remove in interface Collection
Parameters:
o - The element to remove.
Returns:
True if the element was present.

removeAll

public boolean removeAll(Collection c)
Removes all this collection's elements that are also contained in the specified collection (optional operation).

Specified by:
removeAll in interface Collection
Parameters:
c - The collection of elements to remove.
Returns:
True if the collection was affected by this operation.

isEmpty

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

Specified by:
isEmpty in interface Collection
Returns:
True if this list is empty.