There are three sub-categories under the 1.MAP system:
HashMap
The underlying is a hash table data structure that can be stored in NULL keys and null values, not synchronized
---TreeMap
The underlying is a two-fork tree data structure, thread synchronization, which can be used to sort keys in the map collection
Like set, the bottom of the set is map.
When you add an element, if the same key appears, the value added by the thick will overwrite the value of the original key, and the Put method will return the overridden value
Two ways to remove 2.map collections:
(1) KeySet (): Deposit all the keys in the map into the set set because the set has an iterator
You can take all the keys in an iterative manner, and then get the values for each key according to the Get () method
The extraction principle of the Map collection: The map is converted to set and then iterated out
(2) Entrymap (): Returns the map's relationship map set<map.entry<k,v>>
Map.entry is actually an interface, and he's an internal interface in the map interface.
3. Two Collection tool classes: Collections,arrays
(1) The Aslist () method of the Arrays tool class
Aslist: Converts an array into a list collection, using the ideas and methods of the collection to manipulate elements in an array
Note: To convert an array to a collection, you cannot use the Zengshan method of the collection because the length of the array is fixed
If the elements in the array are objects, then the elements in the array are converted directly to the elements in the collection when they become collections.
If an element in the array searches for the base data type, the array will be present as an element in the collection
(2) Set conversions to arrays
An array of the specified type how long should the enemy be defined?
When the array length of the specified type is less than the size of the collection, a new array is created inside the method, and the length is the size of the collection
When the length of an array of the specified type rains heavily on the size of the collection, the array is not newly created, but the passed in array is used instead
So create a just fine array of optimal
Dark Horse Programmer--java Collection framework (map and tools Class)