Java LongStream create from iterate() and limit() method

Description

Java LongStream create from iterate() and limit() method


import java.util.stream.LongStream;

public class Main {
  public static void main(String[] args) {
    LongStream s = LongStream.iterate(1, n  ->  n  + 1)
        .limit(10);//from  ww w .  j  a va2s . com

    s.forEach(System.out::println);
    
    
  }
}



PreviousNext

Related