The difference between a map collection and a collection collection
The map collection is a key and value, and the collection collection is only value.
Collection The bottom of the collection is also a key and value, just hidden.
v
put(K key, v value)
Adds a key to the map collection that is key,value as value and returns null if the addition succeeds, otherwise returns value.
This means that the key in the map collection cannot be duplicated, which is similar to the elements in the set set that cannot be duplicated, but the value in the Map collection can be duplicated.
void
putall(Map<? extends K,? extends V> m)
Adds all elements of the specified collection to the Map collection
void
Clear()
Delete all the key values in the Map collection
boolean
containskey(Object key)
The check out map collection contains no elements of key key and returns true if any, otherwise false.
boolean
containsvalue(Object value)
The check out map collection has no element that contains value value and returns True if any, otherwise false.
Set<map.entry<K,V>>
entryset()
Returns a map to a set set, returned to the set in the form of Key=value in the Map collection.
boolean
equals(Object o)
Determines whether the elements of the two set set are the same
The lower level also overrides the Equals method
When we look at the HashMap collection, we do not find the Equals method, so we go to his parent class.
V
get(Object key)
Gets the value of the corresponding element according to the key of the element in the Map collection
int
hashcode()
Returns the hash code value of the Map collection
boolean
isEmpty()
Checks out if there are elements in the map collection, returns True if none, and returns False if there are elements
Set<K>
keySet()
Returns all keys in the map collection
V
Remove(Object key)
Remove the key as the key value of the element
int
size()
Returns the number of elements in the map collection
Collection<V>
values()
Returns all the value in the Map collection to a collection collection
Common methods of Map collections in Java