Skip to content

Commit

Permalink
Return unmodifiable string set from preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
NightlyNexus authored Jan 16, 2017
1 parent a71e8f2 commit e2d7a13
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.TargetApi;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import java.util.Collections;
import java.util.Set;

import static android.os.Build.VERSION_CODES.HONEYCOMB;
Expand All @@ -12,7 +13,7 @@ final class StringSetAdapter implements Preference.Adapter<Set<String>> {
static final StringSetAdapter INSTANCE = new StringSetAdapter();

@Override public Set<String> get(@NonNull String key, @NonNull SharedPreferences preferences) {
return preferences.getStringSet(key, null);
return Collections.unmodifiableSet(preferences.getStringSet(key, null));
}

@Override public void set(@NonNull String key, @NonNull Set<String> value,
Expand Down

0 comments on commit e2d7a13

Please sign in to comment.