Class ListMap.Entries

  • All Implemented Interfaces:
    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>>, java.util.SortedSet<java.util.Map.Entry<K,​V>>
    Enclosing class:
    ListMap<K,​V>

    private class ListMap.Entries
    extends java.util.AbstractSet<java.util.Map.Entry<K,​V>>
    implements java.util.SortedSet<java.util.Map.Entry<K,​V>>
    Represents the set of entries of the enclosing map given by ListMap.entrySet().

    Like base class AbstractSet, this class supports neither Set.add(Object) nor Set.addAll(Collection), i.e. those methods throw an UnsupportedOperationException. In contrast, this class supports methods Set.clear(), Set.remove(Object), Set.removeAll(Collection) and Set.retainAll(Collection). The iterator returned by iterator() supports Iterator.remove().

    See Also:
    ListMap.entrySet
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Entries()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears actually the enclosing ListMap delegating to ListMap.clear().
      java.util.Comparator<? super java.util.Map.Entry<K,​V>> comparator()  
      boolean contains​(java.lang.Object obj)
      Returns actually whether obj is an instance of Map.Entry with a key contained in the enclosing ListMap delegating to ListMap.containsKey(Object).
      java.util.Map.Entry<K,​V> first()  
      private java.lang.Object getKey​(java.lang.Object obj)
      Assumes that obj is a Map.Entry and returns its key.
      java.util.SortedSet<java.util.Map.Entry<K,​V>> headSet​(java.util.Map.Entry<K,​V> toElement)  
      java.util.Iterator<java.util.Map.Entry<K,​V>> iterator()
      Returns actually an instance of ListMap.EntriesIterator.
      private java.util.Map.Entry<K,​V> key2entry​(K key)  
      java.util.Map.Entry<K,​V> last()  
      boolean remove​(java.lang.Object obj)
      Removes obj from the entry set if present and returns whether it was present.
      int size()
      Returns actually the size of the enclosing ListMap delegating to ListMap.size().
      java.util.SortedSet<java.util.Map.Entry<K,​V>> subSet​(java.util.Map.Entry<K,​V> fromElement, java.util.Map.Entry<K,​V> toElement)  
      java.util.SortedSet<java.util.Map.Entry<K,​V>> tailSet​(java.util.Map.Entry<K,​V> fromElement)  
      • Methods inherited from class java.util.AbstractSet

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

        add, addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
      • 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

        add, addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
      • Methods inherited from interface java.util.SortedSet

        spliterator
    • Constructor Detail

      • Entries

        private Entries()
    • Method Detail

      • iterator

        public java.util.Iterator<java.util.Map.Entry<K,​V>> iterator()
        Returns actually an instance of ListMap.EntriesIterator.
        Specified by:
        iterator in interface java.util.Collection<java.util.Map.Entry<K,​V>>
        Specified by:
        iterator in interface java.lang.Iterable<java.util.Map.Entry<K,​V>>
        Specified by:
        iterator in interface java.util.Set<java.util.Map.Entry<K,​V>>
        Specified by:
        iterator in class java.util.AbstractCollection<java.util.Map.Entry<K,​V>>
      • size

        public int size()
        Returns actually the size of the enclosing ListMap delegating to ListMap.size().
        Specified by:
        size in interface java.util.Collection<java.util.Map.Entry<K,​V>>
        Specified by:
        size in interface java.util.Set<java.util.Map.Entry<K,​V>>
        Specified by:
        size in class java.util.AbstractCollection<java.util.Map.Entry<K,​V>>
      • getKey

        private java.lang.Object getKey​(java.lang.Object obj)
        Assumes that obj is a Map.Entry and returns its key.
        Throws:
        java.lang.NullPointerException - if obj is null.
        java.lang.ClassCastException - if obj is neither null nor an instance of Map.Entry.
      • contains

        public boolean contains​(java.lang.Object obj)
        Returns actually whether obj is an instance of Map.Entry with a key contained in the enclosing ListMap delegating to ListMap.containsKey(Object).
        Specified by:
        contains in interface java.util.Collection<java.util.Map.Entry<K,​V>>
        Specified by:
        contains in interface java.util.Set<java.util.Map.Entry<K,​V>>
        Overrides:
        contains in class java.util.AbstractCollection<java.util.Map.Entry<K,​V>>
      • remove

        public boolean remove​(java.lang.Object obj)
        Removes obj from the entry set if present and returns whether it was present. Effectively checks whether obj is an instance of Map.Entry. If not returns false. If it is an instance of Map.Entry removes the according key-value pair from the enclosing ListMap if present. Returns whether obj's key was present when invoking this method. This is done invoking ListMap.Keys.remove(Object).
        Specified by:
        remove in interface java.util.Collection<java.util.Map.Entry<K,​V>>
        Specified by:
        remove in interface java.util.Set<java.util.Map.Entry<K,​V>>
        Overrides:
        remove in class java.util.AbstractCollection<java.util.Map.Entry<K,​V>>
      • clear

        public void clear()
        Clears actually the enclosing ListMap delegating to ListMap.clear().
        Specified by:
        clear in interface java.util.Collection<java.util.Map.Entry<K,​V>>
        Specified by:
        clear in interface java.util.Set<java.util.Map.Entry<K,​V>>
        Overrides:
        clear in class java.util.AbstractCollection<java.util.Map.Entry<K,​V>>
      • comparator

        public java.util.Comparator<? super java.util.Map.Entry<K,​V>> comparator()
        Specified by:
        comparator in interface java.util.SortedSet<java.util.Map.Entry<K,​V>>
      • key2entry

        private java.util.Map.Entry<K,​V> key2entry​(K key)
      • first

        public java.util.Map.Entry<K,​V> first()
        Specified by:
        first in interface java.util.SortedSet<java.util.Map.Entry<K,​V>>
      • last

        public java.util.Map.Entry<K,​V> last()
        Specified by:
        last in interface java.util.SortedSet<java.util.Map.Entry<K,​V>>
      • subSet

        public java.util.SortedSet<java.util.Map.Entry<K,​V>> subSet​(java.util.Map.Entry<K,​V> fromElement,
                                                                          java.util.Map.Entry<K,​V> toElement)
        Specified by:
        subSet in interface java.util.SortedSet<java.util.Map.Entry<K,​V>>
      • headSet

        public java.util.SortedSet<java.util.Map.Entry<K,​V>> headSet​(java.util.Map.Entry<K,​V> toElement)
        Specified by:
        headSet in interface java.util.SortedSet<java.util.Map.Entry<K,​V>>
      • tailSet

        public java.util.SortedSet<java.util.Map.Entry<K,​V>> tailSet​(java.util.Map.Entry<K,​V> fromElement)
        Specified by:
        tailSet in interface java.util.SortedSet<java.util.Map.Entry<K,​V>>