@Test public void testContains() { final SharedPreferencesCache cache = new MapCache(); final Collection<String> exceptKeys = mutableCollectionFrom(PREF_KEYS); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); assertThat(cache.putString(PREF_KEY_STRING, "pref.value"), is(true)); exceptKeys.remove(PREF_KEY_STRING); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); assertThat(cache.putStringSet(PREF_KEY_STRING_SET, new HashSet<String>(0)), is(true)); exceptKeys.remove(PREF_KEY_STRING_SET); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); assertThat(cache.putInt(PREF_KEY_INTEGER, 11), is(true)); exceptKeys.remove(PREF_KEY_INTEGER); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); assertThat(cache.putFloat(PREF_KEY_FLOAT, 0.25f), is(true)); exceptKeys.remove(PREF_KEY_FLOAT); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); assertThat(cache.putLong(PREF_KEY_LONG, 100L), is(true)); exceptKeys.remove(PREF_KEY_LONG); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); assertThat(cache.putBoolean(PREF_KEY_BOOLEAN, true), is(true)); exceptKeys.remove(PREF_KEY_BOOLEAN); assertThatCacheContainsValueForKeysExcept(cache, exceptKeys); }
@Override public boolean contains(@NonNull final String key) { return map.containsKey(key); }
MapCache implements SharedPreferencesCache { @Override public boolean contains(@NonNull final String key) { return map.containsKey(key); } }
MapCache implements SharedPreferencesCache { @Override public boolean contains(@NonNull final String key) { return map.containsKey(key); }  }
MapCache implements SharedPreferencesCache { @Override public boolean contains(@NonNull final String key) { return map.containsKey(key); }  @Override boolean isEmpty(); @Override boolean contains(@NonNull final String key); @Override boolean putString(@NonNull final String key, @Nullable final String value); @Override @Nullable String getString(@NonNull final String key); @Override boolean putStringSet(@NonNull final String key, @Nullable final Set<String> values); @SuppressWarnings("unchecked") @Override @Nullable Set<String> getStringSet(@NonNull final String key); @Override boolean putInt(@NonNull final String key, final int value); @Override int getInt(@NonNull final String key); @Override boolean putFloat(@NonNull final String key, final float value); @Override float getFloat(@NonNull final String key); @Override boolean putLong(@NonNull final String key, final long value); @Override long getLong(@NonNull final String key); @Override boolean putBoolean(@NonNull final String key, final boolean value); @Override boolean getBoolean(@NonNull final String key); @Override boolean evict(@NonNull final String key); @Override int evictAll(); }
MapCache implements SharedPreferencesCache { @Override public boolean contains(@NonNull final String key) { return map.containsKey(key); }  @Override boolean isEmpty(); @Override boolean contains(@NonNull final String key); @Override boolean putString(@NonNull final String key, @Nullable final String value); @Override @Nullable String getString(@NonNull final String key); @Override boolean putStringSet(@NonNull final String key, @Nullable final Set<String> values); @SuppressWarnings("unchecked") @Override @Nullable Set<String> getStringSet(@NonNull final String key); @Override boolean putInt(@NonNull final String key, final int value); @Override int getInt(@NonNull final String key); @Override boolean putFloat(@NonNull final String key, final float value); @Override float getFloat(@NonNull final String key); @Override boolean putLong(@NonNull final String key, final long value); @Override long getLong(@NonNull final String key); @Override boolean putBoolean(@NonNull final String key, final boolean value); @Override boolean getBoolean(@NonNull final String key); @Override boolean evict(@NonNull final String key); @Override int evictAll();  }