```java
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import
java.util.stream.Stream;
public class Main {
public static Stream<Integer> method1(final Integer bound) {
if (bound > 0) {
Supplier<Stream<Integer>> supplier = () -> IntStream.range(0, bound).mapToObj(i -> bound);
return Stream.concat(supplier.get(), Stream.concat(method1(bound - 1), supplier.get()));
}
return Stream.of(0);
}
public static void method2(final Integer bound) {
Runnable print = () -> IntStream.range(0, bound).forEach(i -> System.out.println(bound));
print.run();
method2(bound - 1);
print.run();
}
public static void main(String[] args) {
// Method 1: 返回结果后打印
String result = method1(4).map(Object::toString).collect(Collectors.joining( "" ));
System.out.println(result);
// Method 2: 方法内打印
method2(4);
}
}
```