懒汉式单例
public class RecommendPresenter {
private RecommendPresenter() {
}
private static RecommendPresenter sInstance = null;
/**
* 获取单例对象
* @return
*/
public static RecommendPresenter getInstance() {
if (sInstance == null) {
synchronized (RecommendPresenter.class) {
if (sInstance == null) {
sInstance = new RecommendPresenter();
}
}
}
}
}
发表回复