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

Description

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

import java.util.stream.DoubleStream;

public class Main {
  public static void main(String[] args) {
    DoubleStream s = DoubleStream.iterate(1, n  ->  n  + 1)
        .limit(10);/*from  ww  w.j av  a  2s .  c o  m*/

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



PreviousNext

Related