package com.example.andy.myapplication;

import android.content.Context;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;


public class singleTonExample {
    private static final singleTonExample ourInstance = new singleTonExample();
    private Map<String, Double> map = new HashMap<String, Double>();
    private Context appContext;

    private singleTonExample() {
    }

    public static Context get() {
        return getInstance().getContext();
    }

    public static synchronized singleTonExample getInstance() {

        return ourInstance;
    }

    public void init(Context context) {
        if (appContext == null) {
            this.appContext = context;
        }
    }

    private Context getContext() {
        return appContext;
    }
    public void put(String string, double d) {
        map.put(string,d);
    }
    public String getHashMap() {
       return String.valueOf(Collections.singletonList(Arrays.asList(map)));
    }
}
