public class HashSet extends java.lang.Object implements Set, java.lang.Cloneable, Serializable
| Constructor and Description |
|---|
HashSet() |
HashSet(Collection c) |
HashSet(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Object o)
Adds an element.
|
boolean |
addAll(Collection c) |
void |
clear() |
java.lang.Object |
clone() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(Collection c) |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isEmpty()
Checks if the collection contains elements.
|
Iterator |
iterator()
Returns an iterator over the elements in this collection.
|
boolean |
remove(java.lang.Object o)
Removes one instance of the specified element.
|
boolean |
removeAll(Collection c) |
int |
size()
Returns the number of elements in this collection.
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
java.lang.Object[] |
toArray(java.lang.Object[] a) |
public HashSet()
public HashSet(Collection c)
public HashSet(int initialCapacity)
public boolean add(java.lang.Object o)
Collectionadd in interface Collectionpublic boolean isEmpty()
CollectionisEmpty in interface Collectionpublic Iterator iterator()
Collectioniterator in interface Collectionpublic boolean remove(java.lang.Object o)
Collectionremove in interface Collectiono - the element to be removedpublic int size()
Collectionsize in interface Collectionpublic java.lang.Object[] toArray()
CollectiontoArray in interface Collectionpublic void clear()
public boolean contains(java.lang.Object o)
public java.lang.Object clone()
clone in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean addAll(Collection c)
public boolean containsAll(Collection c)
public boolean removeAll(Collection c)
public java.lang.Object[] toArray(java.lang.Object[] a)