Code example for Set

Methods: addAll, clear

0
    } 
 
    @SuppressWarnings("unchecked") 
    @Override 
    protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
        setValues(restoreValue ? getPersistedStringSet(mValues)
                : (Set<String>) defaultValue);
    } 
 
    public void setEntries(CharSequence[] entries) {
        mEntries = entries;
    } 
 
    public void setEntries(int entriesResId) {
        setEntries(getContext().getResources().getTextArray(entriesResId));
    } 
 
    public void setEntryValues(CharSequence[] entryValues) {
        mEntryValues = entryValues;
    } 
 
    public void setEntryValues(int entryValuesResId) {
        setEntryValues(getContext().getResources().getTextArray(
                entryValuesResId));
    } 
 
    public void setValues(Set<String> values) {
        mValues.clear();
        mValues.addAll(values);
 
        persistStringSet(values);
    } 
}