Java is simple and practical hashmap

Date: 2020/1/14

Function: hashmap simple and practical

IDE:Intellij IDEA

Map is the interface in java another set of key-value store this key value pair, is HashMap map implementation class, stored more efficiently, Further, such a key can HashMap storage of null-null

package testDemo;

import java.util.*;

public class Test {
    public static void main(String[] args){
        Map map = new HashMap();
        map.put("one","一");
        map.put("two","二");
        map.put("three","三");
        map.put("three","3");
        System.out.println(map.keySet());
        System.out.println(map.values());
        map.remove("two");
        System.out.println(map.values());
    }
}

Output is as follows:

[One, TWO, Three]
[I, II, 3]
[I, 3]

Published 76 original articles · won praise 2 · Views 2131

Guess you like

Origin blog.csdn.net/weixin_43476969/article/details/103986086