Code example for CopyOnWriteArrayList

Methods: add

0
        return new MyEditor(); 
    } 
 
    public void registerOnSharedPreferenceChangeListener( 
            OnSharedPreferenceChangeListener listener) {
        mListeners.add(listener);
    } 
 
    public void unregisterOnSharedPreferenceChangeListener( 
            OnSharedPreferenceChangeListener listener) {
        mListeners.remove(listener);
    } 
 
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
            String key) {
        for (OnSharedPreferenceChangeListener listener : mListeners) {
            listener.onSharedPreferenceChanged(this, key);
        } 
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java