public class ValueSortedMap<K,V> extends TreeMap<K,V>
Extends TreeMap sort by value:ValueSortedMap valueSortedMap = ValueSortedMap.nullsFirst(a map);Also use like this:Map<String, Integer> originMap = ImmutableMap.of("b", 2, "a", 1); TreeMap<String, Integer> sortedByValueMap = new TreeMap<>(Comparator.comparing(originMap::get)); sortedByValueMap.putAll(originMap);
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
已过时。
|
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction)
已过时。
|
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction)
已过时。
|
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction)
已过时。
|
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction)
已过时。
|
static <K,V extends Comparable<? super V>> |
nullsFirst(Map<? extends K,? extends V> map) |
static <K,V> ValueSortedMap<K,V> |
nullsFirst(Map<? extends K,? extends V> map,
Comparator<? super V> comparator) |
static <K,V extends Comparable<? super V>> |
nullsLast(Map<? extends K,? extends V> map) |
static <K,V> ValueSortedMap<K,V> |
nullsLast(Map<? extends K,? extends V> map,
Comparator<? super V> comparator) |
V |
put(K k,
V v)
已过时。
|
void |
putAll(Map<? extends K,? extends V> map)
已过时。
|
V |
putIfAbsent(K key,
V value)
已过时。
|
V |
remove(Object o)
已过时。
|
boolean |
remove(Object key,
Object value)
已过时。
|
V |
replace(K key,
V value)
已过时。
|
boolean |
replace(K key,
V oldValue,
V newValue)
已过时。
|
void |
replaceAll(BiFunction<? super K,? super V,? extends V> function)
已过时。
|
ceilingEntry, ceilingKey, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, size, subMap, subMap, tailMap, tailMap, valuesequals, hashCode, isEmpty, toStringequals, getOrDefault, hashCode, isEmptypublic static <K,V extends Comparable<? super V>> ValueSortedMap<K,V> nullsFirst(Map<? extends K,? extends V> map)
public static <K,V> ValueSortedMap<K,V> nullsFirst(Map<? extends K,? extends V> map, Comparator<? super V> comparator)
public static <K,V extends Comparable<? super V>> ValueSortedMap<K,V> nullsLast(Map<? extends K,? extends V> map)
public static <K,V> ValueSortedMap<K,V> nullsLast(Map<? extends K,? extends V> map, Comparator<? super V> comparator)
@Deprecated public final V putIfAbsent(K key, V value)
@Deprecated public final boolean replace(K key, V oldValue, V newValue)
@Deprecated public final V replace(K key, V value)
@Deprecated public final V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
@Deprecated public final V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
@Deprecated public final V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
@Deprecated public final V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
@Deprecated public final void putAll(Map<? extends K,? extends V> map)
@Deprecated public final void replaceAll(BiFunction<? super K,? super V,? extends V> function)
replaceAll 在接口中 Map<K,V>replaceAll 在类中 TreeMap<K,V>@Deprecated public final V remove(Object o)
@Deprecated public final boolean remove(Object key, Object value)
Copyright © 2023. All rights reserved.