Code example for WeakHashMap

public class ShadowSettings { 
    private static class SettingsImpl { 
        private static final WeakHashMap<ContentResolver, Map<String, Object>> dataMap = new WeakHashMap<ContentResolver, Map<String, Object>>();
        public static boolean putInt(ContentResolver cr, String name, int value) {
            get(cr).put(name, value);
            return true; 
        public static int getInt(ContentResolver cr, String name, int def) {
            if (get(cr).get(name) instanceof Integer) {
                return (Integer) get(cr).get(name);
            } else { 
                return def;
Connect your IDE to all the code out there  Get Codota for Java