- java.lang.Object
-
- org.hsqldb.map.BaseHashMap
-
- org.hsqldb.lib.HashSet<E>
-
- All Implemented Interfaces:
Collection<E>,Set<E>
- Direct Known Subclasses:
OrderedHashSet
public class HashSet<E> extends org.hsqldb.map.BaseHashMap implements Set<E>
This class does not store null keys.- Since:
- 1.7.2
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E key)returns true if element is addedbooleanaddAll(E[] keys)returns true if any element is addedbooleanaddAll(E[] keys, int start, int limit)returns true if any addedbooleanaddAll(Collection<? extends E> c)returns true if any element is addedintcapacity()booleancontains(java.lang.Object key)booleancontainsAll(Collection<E> col)Eget(E key)intgetCommonElementCount(Set<E> other)EgetOrAdd(E key)returns existing value or null if added can be used as an Object cacheIterator<E>iterator()booleanremove(E key)returns true if removedbooleanremoveAll(E[] keys)returns true if all were removedbooleanremoveAll(Collection<E> c)returns true if all were removedjava.lang.Object[]toArray()<T> T[]toArray(T[] a)java.lang.StringtoString()Returns a String like "[Drei, zwei, Eins]", exactly like java.util.HashSet.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hsqldb.lib.Collection
clear, isEmpty, size
-
-
-
-
Constructor Detail
-
HashSet
public HashSet()
-
HashSet
public HashSet(int initialCapacity) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
HashSet
public HashSet(int initialCapacity, ObjectComparator<E> comparator) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
HashSet
public HashSet(E[] valueList)
-
-
Method Detail
-
contains
public boolean contains(java.lang.Object key)
- Specified by:
containsin interfaceCollection<E>
-
containsAll
public boolean containsAll(Collection<E> col)
-
getOrAdd
public E getOrAdd(E key)
returns existing value or null if added can be used as an Object cache
-
add
public boolean add(E key)
returns true if element is added- Specified by:
addin interfaceCollection<E>- Parameters:
key- the element- Returns:
- true if added
-
addAll
public boolean addAll(Collection<? extends E> c)
returns true if any element is added- Specified by:
addAllin interfaceCollection<E>- Parameters:
c- the Collection to add- Returns:
- true if any element is added
-
addAll
public boolean addAll(E[] keys)
returns true if any element is added- Parameters:
keys- the array of elements to add- Returns:
- true if any element is added
-
addAll
public boolean addAll(E[] keys, int start, int limit)
returns true if any added- Parameters:
keys- array of keys to addstart- first index to addlimit- limit of index to add- Returns:
- true if any element was added
-
remove
public boolean remove(E key)
returns true if removed- Specified by:
removein interfaceCollection<E>- Parameters:
key- Object to remove- Returns:
- true if removed
-
removeAll
public boolean removeAll(Collection<E> c)
returns true if all were removed- Parameters:
c- Collection of elements to remove- Returns:
- true if all removed
-
removeAll
public boolean removeAll(E[] keys)
returns true if all were removed- Parameters:
keys- E[]- Returns:
- boolean
-
capacity
public int capacity()
-
toArray
public <T> T[] toArray(T[] a)
-
toArray
public java.lang.Object[] toArray()
-
iterator
public Iterator<E> iterator()
- Specified by:
iteratorin interfaceCollection<E>
-
toString
public java.lang.String toString()
Returns a String like "[Drei, zwei, Eins]", exactly like java.util.HashSet.- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation
-
-