Map 里面的方法

V remove(Object key);

 Removes the mapping for a key from this map if it is present.

boolean isEmpty();

Returns true if this map contains no key-value mappings.

 int size();

Returns the number of key-value mappings in this map.  If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

 boolean containsKey(Object key);

Returns true if this map contains a mapping for the specified key.

 boolean containsValue(Object value);

 Returns true if this map maps one or more keys to the specified value.

 V put(K key, V value);

Associates the specified value with the specified key in this map (optional operation).  If the map previously contained a mapping for the key, the old value is replaced by the specified value.

 V remove(Object key);

Removes the mapping for a key from this map if it is present (optional operation).

The map will not contain a mapping for the specified key once the call returns.

void putAll(Map m);

 Copies all of the mappings from the specified map to this map (optional operation).

void clear();

Removes all of the mappings from this map (optional operation).
The map will be empty after this call returns.

Set keySet();

@return a set view of the keys contained in this map

Collection values();

@return a collection view of the values contained in this map

 Set> entrySet();

@return a set view of the mappings contained in this map



你可能感兴趣的:(java)