diff --git a/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java b/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java index 281c1d8..ae0270c 100644 --- a/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java +++ b/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/StringSetAdapter.java @@ -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; @@ -12,7 +13,7 @@ final class StringSetAdapter implements Preference.Adapter> { static final StringSetAdapter INSTANCE = new StringSetAdapter(); @Override public Set 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 value,