Module java.base

Class ConcurrentHashMap.KeySetView<K,V>

    • Method Detail

      • getMappedValue

        public V getMappedValue​()
        Returns the default mapped value for additions, or null if additions are not supported.
        Returns:
        the default mapped value for additions, or null if not supported
      • remove

        public boolean remove​(Object o)
        Removes the key from this map view, by removing the key (and its corresponding value) from the backing map. This method does nothing if the key is not in the map.
        Specified by:
        remove in interface Collection<K>
        Specified by:
        remove in interface Set<K>
        Parameters:
        o - the key to be removed from the backing map
        Returns:
        true if the backing map contained the specified key
        Throws:
        NullPointerException - if the specified key is null
      • add

        public boolean add​(K e)
        Adds the specified key to this set view by mapping the key to the default mapped value in the backing map, if defined.
        Specified by:
        add in interface Collection<K>
        Specified by:
        add in interface Set<K>
        Parameters:
        e - key to be added
        Returns:
        true if this set changed as a result of the call
        Throws:
        NullPointerException - if the specified key is null
        UnsupportedOperationException - if no default mapped value for additions was provided
      • addAll

        public boolean addAll​(Collection<? extends K> c)
        Adds all of the elements in the specified collection to this set, as if by calling add(K) on each one.
        Specified by:
        addAll in interface Collection<K>
        Specified by:
        addAll in interface Set<K>
        Parameters:
        c - the elements to be inserted into this set
        Returns:
        true if this set changed as a result of the call
        Throws:
        NullPointerException - if the collection or any of its elements are null
        UnsupportedOperationException - if no default mapped value for additions was provided
      • getMap

        public ConcurrentHashMap<K,V> getMap​()
        Returns the map backing this view.
        Returns:
        the map backing this view
      • clear

        public final void clear​()
        Removes all of the elements from this view, by removing all the mappings from the map backing this view.
        Specified by:
        clear in interface Collection<K>
      • size

        public final int size​()
        Specified by:
        size in interface Collection<K>
      • isEmpty

        public final boolean isEmpty​()
        Specified by:
        isEmpty in interface Collection<K>
      • toArray

        public final <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface Collection<K>
      • toString

        public final String toString​()
        Returns a string representation of this collection. The string representation consists of the string representations of the collection's elements in the order they are returned by its iterator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String.valueOf(Object).
        Overrides:
        toString in class Object
        Returns:
        a string representation of this collection