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

xxl.mathematica.map.KeySortBy Maven / Gradle / Ivy

package xxl.mathematica.map;

import java.util.Comparator;
import java.util.Map;
import java.util.function.Function;

/**
 * 键排序方式
 */
public class KeySortBy {
    /**
     * 通过转换f作用于K得到的S进行排序
     *
     * @param map
     * @param f
     * @param 
     * @param 
     * @param 
     * @return
     */
    public static > Map keySortBy(Map map, Function f) {
        return io.vavr.collection.TreeMap.ofAll(Comparator.comparing(f), map).toJavaMap();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy