Android APIs
public class

ObservableArrayMap

extends ArrayMap<K, V>
implements ObservableMap<K, V>
java.lang.Object
   ↳ android.support.v4.util.SimpleArrayMap<K, V>
     ↳ android.support.v4.util.ArrayMap<K, V>
       ↳ android.databinding.ObservableArrayMap<K, V>

Summary

Public Constructors
ObservableArrayMap()
Public Methods
void addOnMapChangedCallback(OnMapChangedCallback<? extends ObservableMap<K, V>, K, V> listener)
Adds a callback to listen for changes to the ObservableMap.
void clear()
Make the array map empty.
V put(K k, V v)
Add a new value to the array map.
boolean removeAll(Collection<?> collection)
Remove all keys in the array map that exist in the given collection.
V removeAt(int index)
Remove the key/value mapping at the given index.
void removeOnMapChangedCallback(OnMapChangedCallback<? extends ObservableMap<K, V>, K, V> listener)
Removes a previously added callback.
boolean retainAll(Collection<?> collection)
Remove all keys in the array map that do not exist in the given collection.
V setValueAt(int index, V value)
Set the value at a given index in the array.
[Expand]
Inherited Methods
From class android.support.v4.util.ArrayMap
From class android.support.v4.util.SimpleArrayMap
From class java.lang.Object
From interface java.util.Map
From interface android.databinding.ObservableMap

Public Constructors

public ObservableArrayMap ()

Public Methods

public void addOnMapChangedCallback (OnMapChangedCallback<? extends ObservableMap<K, V>, K, V> listener)

Adds a callback to listen for changes to the ObservableMap.

Parameters
listener The callback to start listening for events.

public void clear ()

Make the array map empty. All storage is released.

public V put (K k, V v)

Add a new value to the array map.

Parameters
k The key under which to store the value. Must not be null. If this key already exists in the array, its value will be replaced.
v The value to store for the given key.
Returns
  • Returns the old value that was stored for the given key, or null if there was no such key.

public boolean removeAll (Collection<?> collection)

Remove all keys in the array map that exist in the given collection.

Parameters
collection The collection whose contents are to be used to remove keys.
Returns
  • Returns true if any keys were removed from the array map, else false.

public V removeAt (int index)

Remove the key/value mapping at the given index.

Parameters
index The desired index, must be between 0 and size()-1.
Returns
  • Returns the value that was stored at this index.

public void removeOnMapChangedCallback (OnMapChangedCallback<? extends ObservableMap<K, V>, K, V> listener)

Removes a previously added callback.

Parameters
listener The callback that no longer needs to be notified of map changes.

public boolean retainAll (Collection<?> collection)

Remove all keys in the array map that do not exist in the given collection.

Parameters
collection The collection whose contents are to be used to determine which keys to keep.
Returns
  • Returns true if any keys were removed from the array map, else false.

public V setValueAt (int index, V value)

Set the value at a given index in the array.

Parameters
index The desired index, must be between 0 and size()-1.
value The new value to store at this index.
Returns
  • Returns the previous value at the given index.