| java.util.HashSet
HashSet | public class HashSet extends AbstractSet implements Set<E>,Cloneable,Serializable(Code) | | HashSet is an implementation of Set. All optional operations are supported,
adding and removing. The elements can be any objects.
|
Constructor Summary | |
public | HashSet() Constructs a new empty instance of HashSet. | public | HashSet(int capacity) Constructs a new instance of HashSet with the specified capacity. | public | HashSet(int capacity, float loadFactor) Constructs a new instance of HashSet with the specified capacity and load
factor. | public | HashSet(Collection<? extends E> collection) Constructs a new instance of HashSet containing the unique elements in
the specified collection. | | HashSet(HashMap<E, HashSet<E>> backingMap) |
Method Summary | |
public boolean | add(E object) Adds the specified object to this HashSet. | public void | clear() Removes all elements from this HashSet, leaving it empty. | public Object | clone() Answers a new HashSet with the same elements and size as this HashSet. | public boolean | contains(Object object) Searches this HashSet for the specified object. | HashMap<E, HashSet<E>> | createBackingMap(int capacity, float loadFactor) | public boolean | isEmpty() Answers if this HashSet has no elements, a size of zero. | public Iterator<E> | iterator() Answers an Iterator on the elements of this HashSet. | public boolean | remove(Object object) Removes an occurrence of the specified object from this HashSet. | public int | size() Answers the number of elements in this HashSet. |
HashSet | public HashSet()(Code) | | Constructs a new empty instance of HashSet.
|
HashSet | public HashSet(int capacity)(Code) | | Constructs a new instance of HashSet with the specified capacity.
Parameters: capacity - the initial capacity of this HashSet |
HashSet | public HashSet(int capacity, float loadFactor)(Code) | | Constructs a new instance of HashSet with the specified capacity and load
factor.
Parameters: capacity - the initial capacity Parameters: loadFactor - the initial load factor |
HashSet | public HashSet(Collection<? extends E> collection)(Code) | | Constructs a new instance of HashSet containing the unique elements in
the specified collection.
Parameters: collection - the collection of elements to add |
add | public boolean add(E object)(Code) | | Adds the specified object to this HashSet.
Parameters: object - the object to add true when this HashSet did not already contain the object, falseotherwise |
clone | public Object clone()(Code) | | Answers a new HashSet with the same elements and size as this HashSet.
a shallow copy of this HashSet See Also: java.lang.Cloneable |
contains | public boolean contains(Object object)(Code) | | Searches this HashSet for the specified object.
Parameters: object - the object to search for true if object is an element of this HashSet,false otherwise |
isEmpty | public boolean isEmpty()(Code) | | Answers if this HashSet has no elements, a size of zero.
true if this HashSet has no elements, false otherwise See Also: HashSet.size |
iterator | public Iterator<E> iterator()(Code) | | Answers an Iterator on the elements of this HashSet.
an Iterator on the elements of this HashSet See Also: Iterator |
remove | public boolean remove(Object object)(Code) | | Removes an occurrence of the specified object from this HashSet.
Parameters: object - the object to remove true if this HashSet is modified, false otherwise |
size | public int size()(Code) | | Answers the number of elements in this HashSet.
the number of elements in this HashSet |
|
|