put(K key,V value)
参数说明: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); }运行结果为“Map 集合的大小为:4”。
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有