aboutsummaryrefslogtreecommitdiff
path: root/website/usageExamples/GetterLazyExample_pre.jpage
blob: ca6c9d582b18c65c7c87925fca5a9899497f147f (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 double[] cached = expensive();
	
	private double[] expensive() {
		double[] result = new double[1000000];
		for (int i = 0; i < result.length; i++) {
			result[i] = Math.asin(i);
		}
		return result;
	}
}