Java 8 Streams Java Java API
Interface:
java.util.stream.LongStream
Method:
static LongStream iterate(long seed,
LongUnaryOperator f)
Returns an infinite sequential ordered LongStream produced by iterative application of the provided LongUnaryOperator . The seed is the initial element of the iteration.
Examples
package com.logicbig.example.longstream;
import java.util.stream.LongStream;
public class IterateExample {
public static void main(String... args) { LongStream.iterate(10, (lg) -> lg + 5) .limit(10) .forEach(System.out::println);
} }
Output10 15 20 25 30 35 40 45 50 55
|