1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
 
public class GuGuStreamRecursion {
 
    static final int START_NUM = 1;
    static final int MAX_NUM = 9;
 
    static final int TO_START = 2;
    static final int PER_LINE = 3;
 
    static final int START_Y = 1;
    static final int END_Y = 3;
 
    public static void main(String[] args) throws java.lang.Exception {
        List<Integer> num = IntStream.rangeClosed(START_NUM, MAX_NUM).boxed().collect(Collectors.toList());
        printline(num, PER_LINE, TO_START, START_Y, END_Y, MAX_NUM);
    }
 
    private static String printline(List<Integer> num, int perLine, int toStart, int startY, int endY, int maxNum ) {
        recursive(num, startY - 1, endY - startY + 1, toStart - 1, perLine, maxNum);
        return "";
    }
 
    private static int recursive(List<Integer> num, int skip, int limitY, int curStart, int perLine, int maxNum)  {
 
        if(curStart + 1 > maxNum)
            return 0;
 
        System.out.println((curStart + 1+ " To " + ((curStart + perLine > maxNum)? maxNum:(curStart + perLine)));
 
        num.stream().skip(skip).limit(limitY).forEach(line -> {
            num.stream().skip(curStart).limit(perLine).forEach(x -> {
                System.out.print(x + "*" + line + "=" + line * x + "\t");
            });
            System.out.println();
        });
 
        System.out.println();
 
        return recursive(num, skip, limitY, curStart + perLine, perLine, maxNum);
    }
 
}
cs

뭔가 졸라 덕지덕지 더럽당.
ㅇㅇ

걍 연습삼아 짜본건데.. 뭔가 졸라 해서는 안될 짓을 한 느낌이다.
ㅇㅇ