14条建议,使你的IT职业生涯更上一层楼
2013-08-09 07:54
239 查看
package org.wyh; import java.util.*; public class GetEveryTotal{ /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<String> list = new ArrayList<String>(); list.add("1"); list.add("1"); list.add("1"); list.add("3"); list.add("3"); list.add("2"); list.add("4"); HashMap<String, Integer> hash = new HashMap<String, Integer>(); for (int i = 0; i < list.size(); i++) { try { if (!hash.isEmpty() && hash.containsKey(list.get(i))) { hash.put(list.get(i).toString(), hash.get(list.get(i)) + 1); } else { hash.put(list.get(i).toString(), 1); } } catch (Exception e) { } } Set<String> set = hash.keySet(); for (String key : set) { System.out.println(key + "==>" + hash.get(key)); } } }
相关文章推荐
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议 使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 【Mood-5】14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 14条建议 使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼
- 【Mood-5】14条建议,使你的IT职业生涯更上一层楼
- 14条建议,使你的IT职业生涯更上一层楼