[all packages]
[package pizza.util]
[class hierarchy]
[index]
public class pizza.util.Set<A>
(source file: pizza/util/Set.pizza)
java.lang.Object
|
+----pizza.util.Set<A>
The pure class interface.
public class Set<A>
implements java.io.Serializable, Cloneable

Set()
-
Constructs a new, empty set
Set(int)
-
Constructs a new, empty set with the specified initial
capacity.
Set(int, float)
-
Constructs a new, empty hashtable with the specified initial
capacity and the specified

clear()
-
Clears the set so that it has no more elements in it.
clone()
-
Creates a clone of the set
contains(A)
-
Returns true if the collection contains an element for the elem.
elements()
-
Returns an enumeration of the elements
isEmpty()
-
Returns true if the set contains no elements.
put(A)
-
Puts the specified element into the set
rehash()
-
Rehashes the content of the table into a bigger table.
This method is called automatically
remove(A)
-
Removes the element corresponding to the elem
size()
-
Returns the number of elements contained in the set.
toString()
-
Converts to a rather lengthy String.

Set
public Set(int initialCapacity,
float loadFactor);
-
Constructs a new, empty hashtable with the specified initial
capacity and the specified load factor.
- Parameters:
- initialCapacity - the initial number of buckets
- loadFactor - a number between 0.0 and 1.0, it defines
the threshold for rehashing the hashtable into
a bigger one.
- Throws:
- IllegalArgumentException -If the initial capacity
is less than or equal to zero.
- IllegalArgumentException -If the load factor is
less than or equal to zero.
-
Set
public Set(int initialCapacity);
-
Constructs a new, empty set with the specified initial
capacity.
- Parameters:
- initialCapacity - the initial number of buckets
Set
public Set();
-
Constructs a new, empty set. A default capacity and load factor
is used. Note that the set will automatically grow when it gets
full.

size
public int size();
-
Returns the number of elements contained in the set.
isEmpty
public boolean isEmpty();
-
Returns true if the set contains no elements.
elements
public synchronized Enumeration<A> elements();
-
Returns an enumeration of the elements. Use the Enumeration methods
on the returned object to fetch the elements sequentially.
- See also:
- keys, Enumeration
contains
public synchronized boolean contains(A elem);
-
Returns true if the collection contains an element for the elem.
- Parameters:
- elem - the elem that we are looking for
- See also:
- contains
rehash
protected void rehash();
-
Rehashes the content of the table into a bigger table.
This method is called automatically when the set's
size exceeds the threshold.
put
public synchronized void put(A elem);
-
Puts the specified element into the set
remove
public synchronized boolean remove(A elem);
-
Removes the element corresponding to the elem. Does nothing if the
elem is not present.
return true iff `elem' was in set.
- Parameters:
- elem - the elem that needs to be removed
clear
public synchronized void clear();
-
Clears the set so that it has no more elements in it.
clone
public synchronized Object clone();
-
Creates a clone of the set. A shallow copy is made,
the keys and elements themselves are NOT cloned. This is a
relatively expensive operation.
- Overrides:
- clone in class Object
toString
public synchronized String toString();
-
Converts to a rather lengthy String.
- Overrides:
- toString in class Object
[all packages]
[package pizza.util]
[class hierarchy]
[index]
pizza.util.Set.html