【多选题】以下属于Map接口集合常用方法的有()
A. boolean containsKey(Object key)
B. Collection values()
C. void forEach(BiConsumer action)
D. boolean replace(Object key, Object value)
A. boolean containsKey(Object key)
B. Collection values()
C. void forEach(BiConsumer action)
D. boolean replace(Object key, Object value)
举一反三
- 以下方法用于判断Hashtable集合是否包含指定值的是( ) A: void Add(object key,object value) B: void Clear() C: ool Contains(object key) D: ool ContainsValue(object value)
- 中国大学MOOC: 以下Pair泛型类public class Pair<K, V> { public Pair(K key, V value) { this.key = key; this.value = value; } public K getKey(); { return key; } public V getValue(); { return value; } public void setKey(K key) { this.key = key; } public void setValue(V value) { this.value = value; } private K key; private V value;}经过类型擦除后,变成以下类public class Pair { public Pair(Object key, Object value) { this.key = key; this.value = value; } public Object getKey() { return key; } public Object getValue() { return value; } public void setKey(Object key) { this.key = key; } public void setValue(Object value) { this.value = value; } private Object key; private Object value;}
- put(Object key, Object value)和get(Object key)方法分别用于向Map中存入元素和取出元素。
- 下面哪些方法是Collection接口的? A: remove(o:Object):boolean B: removeAll(c:Collection;):boolean C: delete(o:E):boolean D: deleteAll(c:Collection;):boolean
- Java的集合框架中重要的接口java.util.Collection定义了许多方法。下列不是Collection接口所定义的的方法是( )。 A: int size() B: boolean containsAll(Collection c) C: compareTo(Object obj) D: boolean remove(Object obj)