Package eu.simuline.util
Class ListMap.Entries
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<Map.Entry<K,V>>
-
- eu.simuline.util.ListMap.Entries
-
- All Implemented Interfaces:
Iterable<Map.Entry<K,V>>,Collection<Map.Entry<K,V>>,Set<Map.Entry<K,V>>,SortedSet<Map.Entry<K,V>>
private class ListMap.Entries extends AbstractSet<Map.Entry<K,V>> implements SortedSet<Map.Entry<K,V>>
Represents the set of entries of the enclosing map given byListMap.entrySet().Like base class
AbstractSet, this class supports neitherSet.add(Object)norSet.addAll(Collection), i.e. those methods throw anUnsupportedOperationException. In contrast, this class supports methodsSet.clear(),Set.remove(Object),Set.removeAll(Collection)andSet.retainAll(Collection). The iterator returned byiterator()supportsIterator.remove().- See Also:
ListMap.entrySet
-
-
Constructor Summary
Constructors Modifier Constructor Description privateEntries()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears actually the enclosingListMapdelegating toListMap.clear().Comparator<? super Map.Entry<K,V>>comparator()booleancontains(Object obj)Returns actually whetherobjis an instance ofMap.Entrywith a key contained in the enclosingListMapdelegating toListMap.containsKey(Object).Map.Entry<K,V>first()private ObjectgetKey(Object obj)Assumes thatobjis aMap.Entryand returns its key.SortedSet<Map.Entry<K,V>>headSet(Map.Entry<K,V> toElement)Iterator<Map.Entry<K,V>>iterator()Returns actually an instance ofListMap.EntriesIterator.private Map.Entry<K,V>key2entry(K key)Map.Entry<K,V>last()booleanremove(Object obj)Removesobjfrom the entry set if present and returns whether it was present.intsize()Returns actually the size of the enclosingListMapdelegating toListMap.size().SortedSet<Map.Entry<K,V>>subSet(Map.Entry<K,V> fromElement, Map.Entry<K,V> toElement)SortedSet<Map.Entry<K,V>>tailSet(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.util.Set
add, addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
-
Methods inherited from interface java.util.SortedSet
spliterator
-
-
-
-
Method Detail
-
iterator
public Iterator<Map.Entry<K,V>> iterator()
Returns actually an instance ofListMap.EntriesIterator.
-
size
public int size()
Returns actually the size of the enclosingListMapdelegating toListMap.size().
-
getKey
private Object getKey(Object obj)
Assumes thatobjis aMap.Entryand returns its key.- Throws:
NullPointerException- ifobjisnull.ClassCastException- ifobjis neithernullnor an instance ofMap.Entry.
-
contains
public boolean contains(Object obj)
Returns actually whetherobjis an instance ofMap.Entrywith a key contained in the enclosingListMapdelegating toListMap.containsKey(Object).
-
remove
public boolean remove(Object obj)
Removesobjfrom the entry set if present and returns whether it was present. Effectively checks whetherobjis an instance ofMap.Entry. If not returnsfalse. If it is an instance ofMap.Entryremoves the according key-value pair from the enclosingListMapif present. Returns whetherobj's key was present when invoking this method. This is done invokingListMap.Keys.remove(Object).
-
clear
public void clear()
Clears actually the enclosingListMapdelegating toListMap.clear().
-
comparator
public Comparator<? super Map.Entry<K,V>> comparator()
- Specified by:
comparatorin interfaceSortedSet<Map.Entry<K,V>>
-
subSet
public SortedSet<Map.Entry<K,V>> subSet(Map.Entry<K,V> fromElement, Map.Entry<K,V> toElement)
-
-