All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nlpcn.commons.lang.util.CollectionUtil Maven / Gradle / Ivy

package org.nlpcn.commons.lang.util;

import java.util.*;

public class CollectionUtil {
	/**
	 * map 按照value排序
	 *
	 * @return
	 */
	public static  List> sortMapByValue(Map map, final int sort) {
		List> orderList = new ArrayList>(map.entrySet());
		Collections.sort(orderList, new Comparator>() {
			@Override
			@SuppressWarnings("unchecked")
			public int compare(Map.Entry o1, Map.Entry o2) {
				return (((Comparable) o2.getValue()).compareTo(o1.getValue())) * sort;
			}
		});
		return orderList;
	}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy