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

com.neko233.toolchain.common.base.ListGenerator233 Maven / Gradle / Ivy

package com.neko233.toolchain.common.base;

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

/**
 * @author SolarisNeko
 * Date on 2023-01-30
 */
public class ListGenerator233 {

    public static  List generateObjectByCount(int count, Function function) {
        return generateObjectByCount(count, 0, function);
    }

    public static  List generateObjectByCount(int count, int startIndex, Function function) {
        final List ds = new ArrayList<>();
        for (int i = startIndex; i < count; i++) {
            ds.add(function.apply(i));
        }
        return ds;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy