BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Class HashSet

java.lang.Object
  |
  +--brutil.HashSet
All Implemented Interfaces:
Collection, Set

public class HashSet
extends java.lang.Object
implements Set


Inner Class Summary
protected  class HashSet.Table
           
 
Constructor Summary
HashSet()
           
 
Method Summary
 java.lang.Object add(java.lang.Object elt)
          Add the specified object to the Set.
 void clear()
          Removes all the items from this HashSet
 boolean contains(java.lang.Object elt)
          Tells if the specified object is contained within this set.
 java.lang.Object find(java.lang.Object elt)
           
 boolean isEmpty()
          Returns true if the Collection contains no elements, false otherwise
 java.util.Iterator iterator()
          Returns an iterator over the elements in the set.
 java.lang.Object remove(java.lang.Object elt)
          Removes the specified object from the Set, if present.
 int size()
          Returns the number of elements in the Set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashSet

public HashSet()
Method Detail

add

public java.lang.Object add(java.lang.Object elt)
Add the specified object to the Set. Unless the implementing class is also a MultiSet, there may only be one instance of the object in the set.
Specified by:
add in interface Set
Parameters:
o - The object to add to the Set.
Returns:
Object that was overwritten byte this add null otherwise.

contains

public boolean contains(java.lang.Object elt)
Tells if the specified object is contained within this set.
Specified by:
contains in interface Set
Parameters:
o - The object to search for in the Set. return size;
Returns:
true if the object is contained in the set, false otherwise.

iterator

public java.util.Iterator iterator()
Description copied from interface: Set
Returns an iterator over the elements in the set.
Specified by:
iterator in interface Set
Following copied from interface: brutil.Set
Returns:
An iterator of the elements in the set.

isEmpty

public boolean isEmpty()
Description copied from interface: Collection
Returns true if the Collection contains no elements, false otherwise
Specified by:
isEmpty in interface Set
Returns:
true if the Set is empty, false otherwise.

clear

public void clear()
Removes all the items from this HashSet
Specified by:
clear in interface Collection

remove

public java.lang.Object remove(java.lang.Object elt)
Removes the specified object from the Set, if present.
Specified by:
remove in interface Set
Parameters:
o - The object to remove.
Returns:
Object if the object was in the Set, null otherwise.

find

public java.lang.Object find(java.lang.Object elt)
Specified by:
find in interface Set
Following copied from interface: brutil.Set
Returns:
the contained item that matches the parameter with respect to its .equals()

size

public int size()
Returns the number of elements in the Set.
Specified by:
size in interface Collection
Returns:
The number of elements in the Set.


BRUtil - Making Java a Kinder, Gentler, Place to be.