Java 8 Streams Java Java API
Interface:
java.util.stream.DoubleStream
Method:
static DoubleStream iterate(double seed,
DoubleUnaryOperator f)
Returns an infinite sequential ordered DoubleStream produced by iterative application of the provided DoubleUnaryOperator . The seed is the initial element of the iteration.
Examples
package com.logicbig.example.doublestream;
import java.util.stream.DoubleStream;
public class IterateExample {
public static void main(String... args) { DoubleStream.iterate(1, d -> d + 0.5) .limit(5) .forEach(System.out::println); } }
Output1.0 1.5 2.0 2.5 3.0
|