|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.HashSet<E>
public class HashSet<E>
HashSet is an implementation of Set. All optional operations are supported, adding and removing. The elements can be any objects.
| Field Summary | |
|---|---|
(package private) HashMap<E,HashSet<E>> |
backingMap
|
| Constructor Summary | |
|---|---|
HashSet()
Constructs a new empty instance of HashSet. |
|
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)
|
|
HashSet(int capacity)
Constructs a new instance of HashSet with the specified capacity. |
|
HashSet(int capacity,
float loadFactor)
Constructs a new instance of HashSet with the specified capacity and load factor. |
|
| Method Summary | |
|---|---|
boolean |
add(E object)
Adds the specified object to this HashSet. |
void |
clear()
Removes all elements from this HashSet, leaving it empty. |
Object |
clone()
Returns a new HashSet with the same elements and size as this HashSet. |
boolean |
contains(Object object)
Searches this HashSet for the specified object. |
(package private) HashMap<E,HashSet<E>> |
createBackingMap(int capacity,
float loadFactor)
|
boolean |
isEmpty()
Returns if this HashSet has no elements, a size of zero. |
Iterator<E> |
iterator()
Returns an Iterator on the elements of this HashSet. |
boolean |
remove(Object object)
Removes an occurrence of the specified object from this HashSet. |
int |
size()
Returns the number of elements in this HashSet. |
| 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 |
| Field Detail |
|---|
transient HashMap<E,HashSet<E>> backingMap
| Constructor Detail |
|---|
public HashSet()
public HashSet(int capacity)
capacity - the initial capacity of this HashSet
public HashSet(int capacity,
float loadFactor)
capacity - the initial capacityloadFactor - the initial load factorpublic HashSet(Collection<? extends E> collection)
collection - the collection of elements to addHashSet(HashMap<E,HashSet<E>> backingMap)
| Method Detail |
|---|
public boolean add(E object)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>object - the object to add
public void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>isEmpty(),
size()public Object clone()
clone in class ObjectCloneablepublic boolean contains(Object object)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>object - the object to search for
object is an element of this HashSet,
false otherwisepublic boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>size()public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface Set<E>iterator in class AbstractCollection<E>Iteratorpublic boolean remove(Object object)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>object - the object to remove
public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>
HashMap<E,HashSet<E>> createBackingMap(int capacity,
float loadFactor)
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||