K
- 键类型V
- 值类型public class TableMap<K,V> extends Object implements Map<K,V>, Iterable<Map.Entry<K,V>>, Serializable
Constructor and Description |
---|
TableMap()
构造
|
TableMap(int size)
构造
|
TableMap(K[] keys,
V[] values)
构造
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
void |
forEach(BiConsumer<? super K,? super V> action) |
V |
get(Object key) |
K |
getKey(V value)
根据value获得对应的key,只返回找到的第一个value对应的key值
|
List<K> |
getKeys(V value)
获取指定value对应的所有key
|
List<V> |
getValues(K key)
获取指定key对应的所有值
|
boolean |
isEmpty() |
Iterator<Map.Entry<K,V>> |
iterator() |
List<K> |
keys()
获取所有键,可重复,不可修改
|
Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key)
移除指定的所有键和对应的所有值
|
boolean |
remove(Object key,
Object value) |
V |
removeByIndex(int index)
移除指定位置的键值对
|
V |
replace(K key,
V value)
替换指定key的所有值为指定值
|
boolean |
replace(K key,
V oldValue,
V newValue) |
void |
replaceAll(BiFunction<? super K,? super V,? extends V> function) |
int |
size() |
String |
toString() |
Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, equals, getOrDefault, hashCode, merge, putIfAbsent
forEach, spliterator
public TableMap()
public TableMap(int size)
size
- 初始容量public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public K getKey(V value)
value
- 值public List<V> getValues(K key)
key
- 键public List<K> getKeys(V value)
value
- 值public V removeByIndex(int index)
index
- 位置,不能越界public void forEach(BiConsumer<? super K,? super V> action)
public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
replaceAll
in interface Map<K,V>
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
computeIfPresent
in interface Map<K,V>
Copyright © 2024. All rights reserved.