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

xxl.mathematica.list.Array Maven / Gradle / Ivy

package xxl.mathematica.list;


import java.util.List;
import java.util.function.Function;

/**
 * 数组
 */

public class Array {
    /**
     * 以0为起点
     *
     * @param function
     * @param n
     * @param 
     * @return
     */
    public static  List array(Function function, int n) {
        return array(function, n, 0);
    }

    /**
     * 以r为起点生成n个值
     *
     * @param function
     * @param n        生成n个值
     * @param r        以r为起点
     * @param 
     * @return
     */
    public static  List array(Function function, int n, int r) {
        return io.vavr.collection.List.rangeBy(r, r + n, 1)
                .map(function::apply)
                .asJava();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy