Java Map. Put() method: get all the key names of the map collection

put(K key,V value)

Example

public static void main(String[] args)throws InterruptedException{
    Map map = new HashMap();
    map.put("apple","新鲜的苹果");
    map.put("computer","配置优良的计算机");
    map.put("book","堆积成山的图书");
    map.put("time",new Date());
    int size = map.size();
    System.out.println("Map集合的大小为:"+size);
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>