A better singleton without synchronized.

http://stackoverflow.com/questions/16106260/thread-safe-singleton-class

public class Something {
    private Something() {}

    private static class LazyHolder {
        private static final Something INSTANCE = new Something();
    }

    public static Something getInstance() {
        return LazyHolder.INSTANCE;
    }
}
原文地址:https://www.cnblogs.com/chuiyuan/p/5888815.html