Map Interface Overview
* View API to know:
* Objects that map keys to values
* A map cannot contain duplicate keys
* Each key can be mapped to at most one value
The difference between the map interface and the collection interface
* Map is a double row, collection is a single row
* Map key is unique, collection sub-system set is unique
* The data structure value of the map collection is valid for the key, regardless of the value; The data structure of the collection collection is valid for the element
HashSet bottom is map; < key, value new object>
Features of the Map collection
* A: Add features
* V put (K key,v value): add element.
* If the key is stored for the first time, the element is stored directly, returning NULL
* If the key does not exist for the first time, replace the previous value with a value and return the previous value
* B: Delete function
* Void Clear (): Removes all key-value pair elements
* V Remove (Object key): Deletes the key value pair element according to the key, and returns the value
* C: Judging function
* Boolean ContainsKey (Object key): Determines whether the collection contains the specified key
* Boolean Containsvalue (Object value): Determines whether the collection contains the specified value
* Boolean isEmpty (): Determines whether the collection is empty
* D: Get function
* set<map.entry<k,v>> EntrySet ():
* V get (Object key): Gets the value according to the key
* set<k> KeySet (): Gets the collection of all the keys in the collection
* Collection<v> values (): Gets the collection of all values in the collection
* E: Length function
* int size (): Returns the number of key-value pairs in the collection
Here, the integer return value is the value that is saved before the data is placed, and is placed in an empty position before map.put;
Java Map Interface