singleton

how can I change the code generated from "new -> Singleton"?

I prefered this implementation due to the bottleneck of using "synchronized":

public class Test {
private static Test ourInstance;

static {
outInstance = new Test();
}

public static Test getInstance() {
return ourInstance;
}

private Test() {
}
}

0

请先登录再写评论。