Module org.hsqldb

Class 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)
    • Field Summary

      • Fields inherited from class org.hsqldb.map.BaseHashMap

        ACCESS_MAX, emptyObjectArray
    • Constructor Detail

      • HashSet

        public HashSet()
      • HashSet

        public HashSet​(int initialCapacity)
                throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • HashSet

        public HashSet​(int initialCapacity,
                       ObjectComparator comparator)
                throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • HashSet

        public HashSet​(java.lang.Object[] valueList)
    • Method Detail

      • contains

        public boolean contains​(java.lang.Object key)
        Specified by:
        contains in interface Collection<E>
      • containsAll

        public boolean containsAll​(Collection<?> col)
      • getOrAdd

        public E getOrAdd​(E key)
      • get

        public E get​(E key)
      • add

        public boolean add​(E key)
        returns true if element is added
        Specified by:
        add in interface Collection<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 interface Collection<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 add
        start - first index to add
        limit - limit of index to add
        Returns:
        true if any element was added
      • remove

        public boolean remove​(java.lang.Object key)
        returns true if removed
        Specified by:
        remove in interface Collection<E>
        Parameters:
        key - Object to remove
        Returns:
        true if removed
      • removeAll

        public boolean removeAll​(Collection<?> c)
        returns true if all were removed
        Parameters:
        c - Collection of elements to remove
        Returns:
        true if all removed
      • retainAll

        public boolean retainAll​(Collection<?> c)
      • removeAll

        public boolean removeAll​(E[] keys)
        returns true if all were removed
        Parameters:
        keys - E[]
        Returns:
        boolean
      • getCommonElementCount

        public int getCommonElementCount​(Set<E> other)
      • toArray

        public <T> T[] toArray​(T[] a)
      • toArray

        public java.lang.Object[] toArray()
      • toString

        public java.lang.String toString()
        Returns a String like "[Drei, zwei, Eins]", exactly like java.util.HashSet.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation