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