Package org.djutils.immutablecollections
Class ImmutableMap.ImmutableEntry<K,V> 
java.lang.Object
org.djutils.immutablecollections.ImmutableMap.ImmutableEntry<K,V> 
- Type Parameters:
- K- key
- V- value
- Enclosing interface:
- ImmutableMap<K,V> 
A map entry (key-value pair). The 
Map.entrySet method returns a collection-view of the map, whose elements
 are of this class. The only way to obtain a reference to a map entry is from the iterator of this collection-view.
 These ImmutableMap.ImmutableEntry objects are valid only for the duration of the iteration; more
 formally, the behavior of a map entry is undefined if the backing map has been modified after the entry was returned by
 the iterator, except through the setValue operation on the map entry.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <K extends Comparable<? super K>,V> 
 Comparator<ImmutableMap.ImmutableEntry<K,V>> Returns a comparator that comparesImmutableMap.ImmutableEntryin natural order on key.static <K,V> Comparator<ImmutableMap.ImmutableEntry<K, V>> comparingByKey(Comparator<? super K> cmp) Returns a comparator that comparesImmutableMap.ImmutableEntryby key using the givenComparator.static <K,V extends Comparable<? super V>> 
 Comparator<ImmutableMap.ImmutableEntry<K,V>> Returns a comparator that comparesImmutableMap.ImmutableEntryin natural order on value.static <K,V> Comparator<ImmutableMap.ImmutableEntry<K, V>> comparingByValue(Comparator<? super V> cmp) Returns a comparator that comparesImmutableMap.ImmutableEntryby value using the givenComparator.booleangetKey()Returns the key corresponding to this entry.getValue()Returns the value corresponding to this entry.inthashCode()toString()
- 
Constructor Details- 
ImmutableEntry- Parameters:
- wrappedEntry- the wrapped entry
 
 
- 
- 
Method Details- 
getKeyReturns the key corresponding to this entry.- Returns:
- the key corresponding to this entry
- Throws:
- IllegalStateException- implementations may, but are not required to, throw this exception if the entry has been removed from the backing map.
 
- 
getValueReturns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator'sremoveoperation), the results of this call are undefined.- Returns:
- the value corresponding to this entry
- Throws:
- IllegalStateException- implementations may, but are not required to, throw this exception if the entry has been removed from the backing map.
 
- 
hashCodepublic int hashCode()
- 
equals
- 
comparingByKeypublic static <K extends Comparable<? super K>,V> Comparator<ImmutableMap.ImmutableEntry<K,V>> comparingByKey()Returns a comparator that comparesImmutableMap.ImmutableEntryin natural order on key.The returned comparator is serializable and throws NullPointerExceptionwhen comparing an entry with a null key.- Type Parameters:
- K- the- Comparabletype of then map keys
- V- the type of the map values
- Returns:
- a comparator that compares ImmutableMap.ImmutableEntryin natural order on key.
- Since:
- 1.8
- See Also:
 
- 
comparingByValuepublic static <K,V extends Comparable<? super V>> Comparator<ImmutableMap.ImmutableEntry<K,V>> comparingByValue()Returns a comparator that comparesImmutableMap.ImmutableEntryin natural order on value.The returned comparator is serializable and throws NullPointerExceptionwhen comparing an entry with null values.- Type Parameters:
- K- the type of the map keys
- V- the- Comparabletype of the map values
- Returns:
- a comparator that compares ImmutableMap.ImmutableEntryin natural order on value.
- Since:
- 1.8
- See Also:
 
- 
comparingByKeypublic static <K,V> Comparator<ImmutableMap.ImmutableEntry<K,V>> comparingByKey(Comparator<? super K> cmp) Returns a comparator that comparesImmutableMap.ImmutableEntryby key using the givenComparator.The returned comparator is serializable if the specified comparator is also serializable. - Type Parameters:
- K- the type of the map keys
- V- the type of the map values
- Parameters:
- cmp- the key- Comparator
- Returns:
- a comparator that compares ImmutableMap.ImmutableEntryby the key.
- Since:
- 1.8
 
- 
comparingByValuepublic static <K,V> Comparator<ImmutableMap.ImmutableEntry<K,V>> comparingByValue(Comparator<? super V> cmp) Returns a comparator that comparesImmutableMap.ImmutableEntryby value using the givenComparator.The returned comparator is serializable if the specified comparator is also serializable. - Type Parameters:
- K- the type of the map keys
- V- the type of the map values
- Parameters:
- cmp- the value- Comparator
- Returns:
- a comparator that compares ImmutableMap.ImmutableEntryby the value.
- Since:
- 1.8
 
- 
toString
 
-