单例的LazyHolder写法
参考 Android 的com.android.server.webkit.SystemImpl 的写法
public class SystemImpl implements SystemInterface {
// Initialization-on-demand holder idiom for getting the WebView provider packages once and
// for all in a thread-safe manner. 是线程安全的。
private static class LazyHolder {
private static final SystemImpl INSTANCE = new SystemImpl();
}
public static SystemImpl getInstance() {
return LazyHolder.INSTANCE;
}
private SystemImpl() {
//初始化
}
}