List list = Arrays.asList("aa,xx,ss,xx,ss,e,w,a,aa".split(","));Map map = new HashMap();for (String s : list) {Integer i = map.get(s);if(i == null)map.put(s, 1);elsemap.put(s, ++i);}System.out.println(map);