Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fc1e78cfd5fef30ca9a1a1d45b89a9df809851db (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
class Example {
	public void example() {
		for (int i = 0; i < 10; i++) {
		}
		int a = 10;
		while (a-- > 0) {
			System.out.println(a);
		}
		do {
			a += 2;
			System.out.println(a);
		} while (a < 50);
	}
}

class Example {
	public String example(int a) {
		if (a < 0) { throw new IllegalArgumentException(); }
		if (a == 0) { return null; }
		if (false) {}
		if (a % 3 == 0) { System.out.println("fizz"); }
		if (a % 5 == 0) {
			System.out.println("buzz");
			return "";
		}
		return Integer.toString(a);
	}
}

class Example {
	Runnable emptyLambda = () -> {};
	Runnable emptyLambda2 = () -> {};
	Runnable tinyLambda = () -> { doSomething(); };
	Runnable smallLambda = () -> { doFirstThing(); doSecondThing(); };
}

class Example {
	static {}

	void foo() {
		if (true) {} else {}
		synchronized (this) {}
		try {} finally {}

		labeled: {}
	}
}

public class Example {
	private int something;

	public int getSomething() { return something; }

	public void setSomehing(int something) { this.something = something; }

	public void doNoting() {}

	public void doOneThing() { System.out.println(); }

	public void doMoreThings() { something = 4; doOneThing(); doOneThing(); }
}

public class EmptyClass {
}

public class TinyClass {
	int a;
}

public class SmallClass {
	int a;
	String b;
}

public class AnonymousClasses {
	EmptyClass emptyAnonymous = new EmptyClass() {
	};
	TinyClass tinyAnonymous = new TinyClass() {
		String b;
	};
	Object o = new SmallClass() {
		int a;

		int getA() { return a; }
	};
}

public enum EmptyEnum {}

public enum TinyEnum { A; }

public enum SmallEnum {
	VALUE(0);
	SmallEnum(int val) {};
}

public enum EnumConstants {
	EMPTY {
	},
	TINY {
		int getVal() { return 2; }
	},
	SMALL {
		int val = 3;

		int getVal() { return 3; }
	};
	int getVal() { return 1; }
}

public @interface EmptyInterface {}

public @interface TinyInterface {
	void run();
}

public @interface SmallInteface {
	int toA();

	String toB();
}

Back to the top