«   2026/09   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
«   2026/09   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

DBILITY

singleton의 최적? 본문

java/basic

singleton의 최적?

DBILITY 2024. 4. 18. 15:12
반응형
public class DataStore {

    private final String TAG = DataStore.class.getSimpleName();
    
    private DataStore() {
        Log.e(TAG, "Init");
    }

    public static DataStore getInstance() {
        return LazyDataStore.instance;
    }

    private static class LazyDataStore {
        private static final DataStore instance = new DataStore();
    }
    
}
반응형
Comments