Вот метод:
Код: Выделить всё
public static Stream multipleOf3(){
return Stream.iterate(1, x -> 3*x).limit(10);
}
Я вызываю метод следующим образом:
Код: Выделить всё
multipleDe3().forEach(System.out::println);
Код: Выделить всё
1
3
9
27
81
243
729
2187
6561
19683
Код: Выделить всё
3*1 = 3,
3*3 = 9,
3*9 = 27, etc...
Подробнее здесь: https://stackoverflow.com/questions/701 ... s-of-three