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;
}
}