日期:2014-05-20 浏览次数:20657 次
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("test.txt"))); Map<String, List<String>> map = new HashMap<String, List<String>>(); String buf; while ((buf=br.readLine()) != null) { String[] v = buf.split(":", 2); if (!map.containsKey(v[0])) { map.put(v[0], new LinkedList<String>()); } map.get(v[0]).add(v[1]); } br.close(); System.out.println(map);