Class ConcurrentReferenceHashSet<E>

  • Type Parameters:
    E - the element type
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

    public class ConcurrentReferenceHashSet<E>
    extends MapDelegateSet<E>
    Set based on top of ConcurrentReferenceHashMap. It's serializable if the elements are serializable.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID
      The serialVersionUID
    • Method Summary

      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

        addAll, containsAll, retainAll, toArray, toArray
      • Methods inherited from class java.lang.Object

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

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        addAll, containsAll, retainAll, spliterator, toArray, toArray
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        The serialVersionUID
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(int initialCapacity,
                                          float loadFactor,
                                          int concurrencyLevel)
        Creates a new, empty set with the specified initial capacity, load factor and concurrency level.
        Parameters:
        initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
        loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
        concurrencyLevel - the estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
        Throws:
        java.lang.IllegalArgumentException - if the initial capacity is negative or the load factor or concurrencyLevel are nonpositive.
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(int initialCapacity,
                                          float loadFactor)
        Creates a new, empty set with the specified initial capacity and load factor and with the default reference types (weak keys, strong values), and concurrencyLevel (16).
        Parameters:
        initialCapacity - The implementation performs internal sizing to accommodate this many elements.
        loadFactor - the load factor threshold, used to control resizing. Resizing may be performed when the average number of elements per bin exceeds this threshold.
        Throws:
        java.lang.IllegalArgumentException - if the initial capacity of elements is negative or the load factor is nonpositive
        Since:
        1.6
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(int initialCapacity,
                                          ConcurrentReferenceHashMap.ReferenceType type)
        Creates a new, empty set with the specified initial capacity, reference type and with default load factor (0.75) and concurrencyLevel (16).
        Parameters:
        initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
        type - the reference type to use
        Throws:
        java.lang.IllegalArgumentException - if the initial capacity of elements is negative.
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(ConcurrentReferenceHashMap.ReferenceType type)
        Creates a new, empty reference set with the specified key and value reference types.
        Parameters:
        type - the reference type to use
        Throws:
        java.lang.IllegalArgumentException - if the initial capacity of elements is negative.
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(ConcurrentReferenceHashMap.ReferenceType type,
                                          java.util.EnumSet<ConcurrentReferenceHashMap.Option> options)
        Creates a new, empty reference set with the specified reference types and behavioral options.
        Parameters:
        type - the reference type to use
        options - the options
        Throws:
        java.lang.IllegalArgumentException - if the initial capacity of elements is negative.
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(int initialCapacity)
        Creates a new, empty set with the specified initial capacity, and with default reference types (weak keys, strong values), load factor (0.75) and concurrencyLevel (16).
        Parameters:
        initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.
        Throws:
        java.lang.IllegalArgumentException - if the initial capacity of elements is negative.
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet()
        Creates a new, empty set with a default initial capacity (16), reference types (weak keys, strong values), default load factor (0.75) and concurrencyLevel (16).
      • ConcurrentReferenceHashSet

        public ConcurrentReferenceHashSet​(java.util.Set<? extends E> s)
        Creates a new set with the same contents as the given set.
        Parameters:
        s - the set