Class UnmodifiableEntrySet<K,​V>

  • Type Parameters:
    K - the type of the keys in the map
    V - the type of the values in the map
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.util.Map.Entry<K,​V>>, java.util.Collection<java.util.Map.Entry<K,​V>>, java.util.Set<java.util.Map.Entry<K,​V>>, Unmodifiable

    public final class UnmodifiableEntrySet<K,​V>
    extends AbstractSetDecorator<java.util.Map.Entry<K,​V>>
    implements Unmodifiable
    Decorates a map entry Set to ensure it can't be altered.

    Attempts to modify it will result in an UnsupportedOperationException.

    Since:
    3.0
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(java.util.Map.Entry<K,​V> object)  
      boolean addAll​(java.util.Collection<? extends java.util.Map.Entry<K,​V>> coll)  
      void clear()  
      java.util.Iterator<java.util.Map.Entry<K,​V>> iterator()  
      boolean remove​(java.lang.Object object)  
      boolean removeAll​(java.util.Collection<?> coll)  
      boolean removeIf​(java.util.function.Predicate<? super java.util.Map.Entry<K,​V>> filter)  
      boolean retainAll​(java.util.Collection<?> coll)  
      java.lang.Object[] toArray()  
      <T> T[] toArray​(T[] array)  
      static <K,​V>
      java.util.Set<java.util.Map.Entry<K,​V>>
      unmodifiableEntrySet​(java.util.Set<java.util.Map.Entry<K,​V>> set)
      Factory method to create an unmodifiable set of Map Entry objects.
      • Methods inherited from class java.lang.Object

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

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

        forEach
      • Methods inherited from interface java.util.Set

        contains, containsAll, isEmpty, size, spliterator
    • Method Detail

      • unmodifiableEntrySet

        public static <K,​V> java.util.Set<java.util.Map.Entry<K,​V>> unmodifiableEntrySet​(java.util.Set<java.util.Map.Entry<K,​V>> set)
        Factory method to create an unmodifiable set of Map Entry objects.
        Type Parameters:
        K - the key type
        V - the value type
        Parameters:
        set - the set to decorate, must not be null
        Returns:
        a new unmodifiable entry set
        Throws:
        java.lang.NullPointerException - if set is null
        Since:
        4.0
      • add

        public boolean add​(java.util.Map.Entry<K,​V> object)
        Specified by:
        add in interface java.util.Collection<K>
        Specified by:
        add in interface java.util.Set<K>
        Overrides:
        add in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • addAll

        public boolean addAll​(java.util.Collection<? extends java.util.Map.Entry<K,​V>> coll)
        Specified by:
        addAll in interface java.util.Collection<K>
        Specified by:
        addAll in interface java.util.Set<K>
        Overrides:
        addAll in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<K>
        Specified by:
        clear in interface java.util.Set<K>
        Overrides:
        clear in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • remove

        public boolean remove​(java.lang.Object object)
        Specified by:
        remove in interface java.util.Collection<K>
        Specified by:
        remove in interface java.util.Set<K>
        Overrides:
        remove in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • removeIf

        public boolean removeIf​(java.util.function.Predicate<? super java.util.Map.Entry<K,​V>> filter)
        Specified by:
        removeIf in interface java.util.Collection<K>
        Overrides:
        removeIf in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
        Since:
        4.4
      • removeAll

        public boolean removeAll​(java.util.Collection<?> coll)
        Specified by:
        removeAll in interface java.util.Collection<K>
        Specified by:
        removeAll in interface java.util.Set<K>
        Overrides:
        removeAll in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> coll)
        Specified by:
        retainAll in interface java.util.Collection<K>
        Specified by:
        retainAll in interface java.util.Set<K>
        Overrides:
        retainAll in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • iterator

        public java.util.Iterator<java.util.Map.Entry<K,​V>> iterator()
        Specified by:
        iterator in interface java.util.Collection<K>
        Specified by:
        iterator in interface java.lang.Iterable<K>
        Specified by:
        iterator in interface java.util.Set<K>
        Overrides:
        iterator in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<K>
        Specified by:
        toArray in interface java.util.Set<K>
        Overrides:
        toArray in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>
      • toArray

        public <T> T[] toArray​(T[] array)
        Specified by:
        toArray in interface java.util.Collection<K>
        Specified by:
        toArray in interface java.util.Set<K>
        Overrides:
        toArray in class AbstractCollectionDecorator<java.util.Map.Entry<K,​V>>