edu.neu.ccs.quick
Class QuickHashSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byjava.util.HashSet
              extended byedu.neu.ccs.quick.QuickHashSet
All Implemented Interfaces:
Cloneable, Collection, Serializable, Set

public class QuickHashSet
extends HashSet

QuickHashSet extends HashSet by adding one constructor and three methods addItems, setItems, and removeItems that handle an array of Object at once.

All constructors of the original HashSet class are provided as well.

No changes are made to the internal data structure or to any inherited methods.

Since:
2.3
Version:
2.3
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.HashSet
 
Constructor Summary
QuickHashSet()
          A constructor that delegates to class HashSet.
QuickHashSet(Collection c)
          A constructor that delegates to class HashSet.
QuickHashSet(int initialCapacity)
          A constructor that delegates to class HashSet.
QuickHashSet(int initialCapacity, float loadFactor)
          A constructor that delegates to class HashSet.
QuickHashSet(Object[] items)
          Constructor that adds the given array of items one-by-one to the hash set.
 
Method Summary
 void addItems(Object[] items)
          Method that adds the given array of items one-by-one to the hash set.
 void removeItems(Object[] items)
          Method that removes the given array of items one-by-one from the hash set.
 void setItems(Object[] items)
          Method that first clears this hash set of any existing items and then adds the given array of items one-by-one to the hash set.
 
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

QuickHashSet

public QuickHashSet()
A constructor that delegates to class HashSet.


QuickHashSet

public QuickHashSet(Collection c)
A constructor that delegates to class HashSet.


QuickHashSet

public QuickHashSet(int initialCapacity)
A constructor that delegates to class HashSet.


QuickHashSet

public QuickHashSet(int initialCapacity,
                    float loadFactor)
A constructor that delegates to class HashSet.


QuickHashSet

public QuickHashSet(Object[] items)

Constructor that adds the given array of items one-by-one to the hash set.

The capacity is set either to 10 or to 1.5 times the length of the array items whichever is larger.

The load factor is set to the default of 0.75.

Parameters:
items - the array of items to add to this hash set
See Also:
addItems(Object[])
Method Detail

addItems

public void addItems(Object[] items)

Method that adds the given array of items one-by-one to the hash set.

If items is null, then does nothing.

Parameters:
items - the array of items to add to this hash set
See Also:
QuickHashSet(Object[]), setItems(Object[]), removeItems(Object[])

setItems

public void setItems(Object[] items)

Method that first clears this hash set of any existing items and then adds the given array of items one-by-one to the hash set.

If items is null, then this method is equivalent to the inherited method clear.

Parameters:
items - the array of items to add to this hash set after clearance
See Also:
addItems(Object[]), removeItems(Object[])

removeItems

public void removeItems(Object[] items)

Method that removes the given array of items one-by-one from the hash set.

If items is null, then does nothing.

Parameters:
items - the array of items to remove from this hash set
See Also:
addItems(Object[]), setItems(Object[])