- String str="1.2,3.4,5.6,7.8,5.56,44.55";
- String[] arr=str.split(",");
- HashMap<Object, Object>map=new HashMap<>();
-
- for (String s : arr) {
- String[]arr2=s.split("\\.");
- map.put(arr2[0], arr2[1]);
- }
- Set<Object> set = map.keySet();
- System.out.println(set);
- Collection<Object> col=map.values();
- System.out.println(col);
复制代码
|