java.lang.Object | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.util.AbstractCollection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.util.AbstractSet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | - | - | java.util.HashSet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This class implements the Set interface, backed by a hash table (actually a HashMap instance).
Constructor | Summary |
---|---|
HashSet() | Creates a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75). |
HashSet(Collection<? extends E> c) | Creates a new set containing the elements in the specified collection. |
HashSet(int initialCapacity) | Creates a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor (0.75). |
HashSet(int initialCapacity, float loadFactor) | Creates a new, empty set; the backing HashMap instance has the specified initial capacity and the specified load factor. |
Return | Method | Summary |
---|---|---|
boolean | add(E e) | Adds the specified element to this set if it is not already present. |
void | clear() | Removes all of the elements from this set. |
Object | clone() | Returns a shallow copy of this HashSet instance: the elements themselves are not cloned. |
boolean | contains(Object o) | Returns true if this set contains the specified element. |
boolean | isEmpty() | Returns true if this set contains no elements. |
Iterator<E> | iterator() | Returns an iterator over the elements in this set. |
boolean | remove(Object o) | Removes the specified element from this set if it is present. |
int | size() | Returns the number of elements in this set (its cardinality). |
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |