aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/GetterLazyExample_pre.jpage
blob: a6ca09669db515dd14f4959d1baf70a8afbb58ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import lombok.Getter;

public class GetterLazyExample {
	@Getter(lazy=true) private final int[] cached = expensive();
	
	private int[] expensive() {
		double[] result = new double[1000000];
		for (int i = 0; i < result.length; i++) {
			result[i] = Math.asin(i);
		}
		return result;
	}
}