我目前有一個String ID列表(List< String>)和一個自定義類的無序列表(List< CustomClass>).我想根據IDS的有序列表來定制自定義類對象的列表.我得到的印象是,最好的方法是使用TreeMap.所以我實現了這個:java map排序,Map mapB = new HashMap();for (S
java对存放实体的list进行排序: List<DistributionAgentsEntity> allAgents = new ArrayList<DistributionAgentsEntity>();Collections.sort(allAgents, new Comparator<DistributionAgentsEntity>() {public int compare(DistributionAgentsEn