Skip to content

Most visited

Recently visited

navigation

ObservableArrayMap

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.

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

ObservableArrayMap

ObservableArrayMap ()

Public methods

addOnMapChangedCallback

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

Adds a callback to listen for changes to the ObservableMap.

Parameters
listener OnMapChangedCallback: The callback to start listening for events.

clear

void clear ()

Make the array map empty. All storage is released.

put

V put (K k, 
                V v)

Add a new value to the array map.

Parameters
k 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 V: The value to store for the given key.

Returns
V Returns the old value that was stored for the given key, or null if there was no such key.

removeAll

boolean removeAll (Collection<?> collection)

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

Parameters
collection Collection: The collection whose contents are to be used to remove keys.

Returns
boolean Returns true if any keys were removed from the array map, else false.

removeAt

V removeAt (int index)

Remove the key/value mapping at the given index.

Parameters
index int: The desired index, must be between 0 and size()-1.

Returns
V Returns the value that was stored at this index.

removeOnMapChangedCallback

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

Removes a previously added callback.

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

retainAll

boolean retainAll (Collection<?> collection)

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

Parameters
collection Collection: The collection whose contents are to be used to determine which keys to keep.

Returns
boolean Returns true if any keys were removed from the array map, else false.

setValueAt

V setValueAt (int index, 
                V value)

Set the value at a given index in the array.

Parameters
index int: The desired index, must be between 0 and size()-1.

value V: The new value to store at this index.

Returns
V Returns the previous value at the given index.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)