Java tutorial
import java.util.function.IntSupplier; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { IntStream.generate(new IntSupplier() { public int getAsInt() { return 2; } }).limit(5).forEach(System.out::println); } }