- 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 boolean
add(E key)
returns true if element is addedboolean
addAll(E[] keys)
returns true if any element is addedboolean
addAll(E[] keys, int start, int limit)
returns true if any addedboolean
addAll(Collection<? extends E> c)
returns true if any element is addedint
capacity()
boolean
contains(java.lang.Object key)
boolean
containsAll(Collection<E> col)
E
get(E key)
int
getCommonElementCount(Set<E> other)
E
getOrAdd(E key)
returns existing value or null if added can be used as an Object cacheIterator<E>
iterator()
boolean
remove(E key)
returns true if removedboolean
removeAll(E[] keys)
returns true if all were removedboolean
removeAll(Collection<E> c)
returns true if all were removedjava.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
java.lang.String
toString()
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:
contains
in 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:
add
in 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:
addAll
in 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:
remove
in 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:
iterator
in interfaceCollection<E>
-
toString
public java.lang.String toString()
Returns a String like "[Drei, zwei, Eins]", exactly like java.util.HashSet.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation
-
-