aboutsummaryrefslogtreecommitdiff
path: root/test/pretty/resource/after/Switch13.java
blob: 363b48dc38e787dca8db43baf627ec351a912be5 (plain)
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
46
47
48
49
50
51
52
53
54
55
public class Switch13 {
	public void basic() {
		switch (5) {
		case 1: 
		case 2: 
			System.out.println("OK");
			break;
		default: 
		}
	}

	public void multiCase() {
		switch (5) {
		case 1, 2: 
			System.out.println("OK");
		default: 
		}
	}

	public int switchExpr1() {
		return switch (5) {
			case 1, 2 -> 0;
			case 3 -> {
				yield 10;
			}
			default -> 10;
		} + 10;
	}

	public int switchExpr2() {
		return switch (5) {
		case 1, 2: 
			System.out.println("Hello");
		case 3: 
			yield 10;
		default: 
			yield 20;
		} + 10;
	}

	public void arrowSwitch() {
		switch (5) {
			case 1, 2 -> System.out.println("Hello");
			case 3 -> {
				System.out.println("");
				break;
			}
		}
	}

	public void emptySwitch() {
		switch (5) {
		}
	}
}