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());
        }
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章