📄 mapdemo.java
字号:
/** * MapDemo.java * * $Id: MapDemo.java,v 1.1 2002/03/14 14:10:39 tmh Exp tmh $ * * $Log: MapDemo.java,v $ * Revision 1.1 2002/03/14 14:10:39 tmh * Initial revision * * Revision 1.1 2002/03/12 13:59:55 tmh * Initial revision * * **//** * Purpose: << You decide >> * * @author Trudy Howles tmh@cs.rit.edu ***/import java.util.*;public class MapDemo { public static void main (String args[] ) { Map m = new HashMap(); for (int i = 0; i < args.length; i++) { Integer frequency = (Integer) m.get (args[i]); if (frequency == null) { m.put (args[i], new Integer (1)); } else { m.put (args[i], new Integer (frequency.intValue() + 1)); } } System.out.println (m); }}// What is actually stored in the map? // Why don't these print in the order in which they were entered?// What is actually printed when the println() statement executes?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -