Class ConcurrentHashSet<V>

  • Type Parameters:
    V - type of the values
    All Implemented Interfaces:
    java.lang.Iterable<V>, java.util.Collection<V>, java.util.Set<V>

    public class ConcurrentHashSet<V>
    extends java.lang.Object
    implements java.util.Set<V>
    Concurrent hash set implementation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Set<V> set  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConcurrentHashSet()
      Constructs a new, empty set.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(V o)
      boolean addAll​(java.util.Collection c)
      void clear()
      boolean contains​(java.lang.Object o)
      boolean containsAll​(java.util.Collection c)
      boolean equals​(java.lang.Object o)
      void forEach​(java.util.function.Consumer<? super V> consumer)
      int hashCode()
      boolean isEmpty()
      java.util.Iterator<V> iterator()
      boolean remove​(java.lang.Object o)
      boolean removeAll​(java.util.Collection c)
      boolean retainAll​(java.util.Collection c)
      int size()
      java.lang.Object[] toArray()
      V[] toArray​(java.lang.Object[] a)
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.util.Set

        spliterator
    • Field Detail

      • set

        private final java.util.Set<V> set
    • Constructor Detail

      • ConcurrentHashSet

        public ConcurrentHashSet()
        Constructs a new, empty set.
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<V>
        Specified by:
        size in interface java.util.Set<V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<V>
        Specified by:
        isEmpty in interface java.util.Set<V>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<V>
        Specified by:
        contains in interface java.util.Set<V>
      • iterator

        public java.util.Iterator<V> iterator()
        Specified by:
        iterator in interface java.util.Collection<V>
        Specified by:
        iterator in interface java.lang.Iterable<V>
        Specified by:
        iterator in interface java.util.Set<V>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<V>
        Specified by:
        toArray in interface java.util.Set<V>
      • add

        public boolean add​(V o)
        Specified by:
        add in interface java.util.Collection<V>
        Specified by:
        add in interface java.util.Set<V>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<V>
        Specified by:
        remove in interface java.util.Set<V>
      • addAll

        public boolean addAll​(java.util.Collection c)
        Specified by:
        addAll in interface java.util.Collection<V>
        Specified by:
        addAll in interface java.util.Set<V>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<V>
        Specified by:
        clear in interface java.util.Set<V>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<V>
        Specified by:
        equals in interface java.util.Set<V>
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<V>
        Specified by:
        hashCode in interface java.util.Set<V>
        Overrides:
        hashCode in class java.lang.Object
      • forEach

        public void forEach​(java.util.function.Consumer<? super V> consumer)
        Specified by:
        forEach in interface java.lang.Iterable<V>
      • removeAll

        public boolean removeAll​(java.util.Collection c)
        Specified by:
        removeAll in interface java.util.Collection<V>
        Specified by:
        removeAll in interface java.util.Set<V>
      • retainAll

        public boolean retainAll​(java.util.Collection c)
        Specified by:
        retainAll in interface java.util.Collection<V>
        Specified by:
        retainAll in interface java.util.Set<V>
      • containsAll

        public boolean containsAll​(java.util.Collection c)
        Specified by:
        containsAll in interface java.util.Collection<V>
        Specified by:
        containsAll in interface java.util.Set<V>
      • toArray

        public V[] toArray​(java.lang.Object[] a)
        Specified by:
        toArray in interface java.util.Collection<V>
        Specified by:
        toArray in interface java.util.Set<V>