List集合根据Map里的两个key值对List集合重新排序

 1.对list进行重新按照时间相同的情况下对总排放量的值进行倒序排序-从大到小

// 对list进行重新按照时间相同的情况下对总排放量进行倒序-从大到小
		if (null != gasResultList && gasResultList.size() > 0) {
			Collections.sort(gasResultList, new Comparator() {

				@Override
				public int compare(Map o1, Map o2) {
					if (o1.get("MONITORTIME").equals(o2.get("MONITORTIME"))) {
						Double one = Double.valueOf(o1.get("totalEmission").toString());
						Double two = Double.valueOf(o2.get("totalEmission").toString());
						return (int) (two - one);
					}
					return 0;
				}
			});

		}

你可能感兴趣的:(Java)