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

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

package xxl.mathematica.map;


import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;

/**
 * 键值映射
 */
public class KeyValueMap {
    /**
     * 将函数作用于映射的键和值上
     *
     * @param f
     * @param map
     * @param 
     * @param 
     * @param 
     * @return
     */
    public static  List keyValueMap(BiFunction f, Map map) {
        return io.vavr.collection.HashMap.ofAll(map)
                .toList()
                .map(tuple2 -> f.apply(tuple2._1(), tuple2._2()))
                .toJavaList();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy