Map Collections Collections framework _03 of j2ee_03_

  1. The Map
    1.1 features: disordered, add elements in the form of key-value pairs, the key can not be repeated, the value can repeat
    it does not inherit the Collection interface
		Map<String, String> map = new Hashtable<String,String>();
		//无序,数据输入顺序与输出顺序不一致
		map.put("aa", "123");
		map.put("bb", "123");
		map.put("cc", "123");
		map.put("dd", "123");
		map.put("ee", "123");

1.2 traversing
1.2.1 Save Set to remove all keys, and then to iterate Set (two kinds)
1.2.2 Remove first save all the Set Entry, and then to traverse this Set

		Set<Entry<String, String>> entrySet = map.entrySet();
		for (Entry<String, String> entry : entrySet) {
			System.out.println(entry);
		}

2. The difference between HashMap and HashTable
synchronize both safe hashtable queued
asynchronous non-secure hashmap

  1. Other
    3.1 Collections: tools, there is provided a method of operating a set of static Collection set
    3.2 Arrays: tools, there is provided a method of operating a set of static array
    class contains various methods for manipulating arrays (such as sorting and searching). This class also contains an array as to allow the list to view the static factory.

Guess you like

Origin blog.csdn.net/qq_43582260/article/details/91359027