Modifier and Type | Method and Description |
---|---|
static <K extends Comparable<? super K>,V> |
comparingByKey()
Returns a comparator that compares
Map.Entry in natural order
on key. |
static <K,V> Comparator<Map.Entry<K,V>> |
comparingByKey(Comparator<? super K> cmp)
Returns a comparator that compares
Map.Entry by key using the
given Comparator . |
static <K,V extends Comparable<? super V>> |
comparingByValue()
Returns a comparator that compares
Map.Entry in natural order
on value. |
static <K,V> Comparator<Map.Entry<K,V>> |
comparingByValue(Comparator<? super V> cmp)
Returns a comparator that compares
Map.Entry by value using
the given Comparator . |
public static <K extends Comparable<? super K>,V> Comparator<Map.Entry<K,V>> comparingByKey()
Map.Entry
in natural order
on key.
The returned comparator is serializable and throws
NullPointerException
when comparing an entry with a null key.
K
- the Comparable
type of then map keysV
- the type of the map valuesMap.Entry
in natural order
on key.Comparable
public static <K,V extends Comparable<? super V>> Comparator<Map.Entry<K,V>> comparingByValue()
Map.Entry
in natural order
on value.
The returned comparator is serializable and throws
NullPointerException
when comparing an entry with null
values.
K
- the type of the map keysV
- the Comparable
type of the map valuesMap.Entry
in natural order
on value.Comparable
public static <K,V> Comparator<Map.Entry<K,V>> comparingByKey(Comparator<? super K> cmp)
Map.Entry
by key using the
given Comparator
.
The returned comparator is serializable if the specified comparator is also serializable.
K
- the type of the map keysV
- the type of the map valuescmp
- the key Comparator
Map.Entry
by the key.public static <K,V> Comparator<Map.Entry<K,V>> comparingByValue(Comparator<? super V> cmp)
Map.Entry
by value using
the given Comparator
.
The returned comparator is serializable if the specified comparator is also serializable.
K
- the type of the map keysV
- the type of the map valuescmp
- the value Comparator
Map.Entry
by the value.Copyright © 2015. All rights reserved.