2016-01-13 16:25:24 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
|
|
|
|
package docs.stream;
|
|
|
|
|
|
2016-01-19 20:26:43 +01:00
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
2016-01-13 16:25:24 +01:00
|
|
|
import akka.japi.Pair;
|
|
|
|
|
import akka.stream.javadsl.*;
|
|
|
|
|
|
|
|
|
|
public class MigrationsJava {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2016-01-19 20:26:43 +01:00
|
|
|
//#expand-continually
|
|
|
|
|
Flow.of(Integer.class).expand(in -> Stream.iterate(in, i -> i).iterator());
|
|
|
|
|
//#expand-continually
|
|
|
|
|
//#expand-state
|
|
|
|
|
Flow.of(Integer.class).expand(in ->
|
|
|
|
|
Stream.iterate(new Pair<>(in, 0),
|
|
|
|
|
p -> new Pair<>(in, p.second() + 1)).iterator());
|
|
|
|
|
//#expand-state
|
2016-01-13 16:25:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|