Java LongStream limit element number
import java.util.stream.LongStream; public class Main { public static void main(String[] args) { LongStream.generate(() -> 99) .limit(10)//w w w . j av a 2s . c om .forEach(System.out::println); } }