JAVA将快速将列表分组并排序键

            for(Object[] objects : list){
        map.put(objects[0].toString(), null);
    }
    for(Map.Entry<String, List<String>> entry:map.entrySet()){
        entry.setValue(new ArrayList<String>());
    }
    for(Object[] objects : list){
        String value = objects[1].toString();
        if(value != null ){
            map.get(objects[0].toString()).add(objects[1].toString());
        }
    }

猜你喜欢

转载自blog.51cto.com/12165865/2117868