Android APIs
public class

ObservableArrayList

extends ArrayList<T>
implements ObservableList<T>
java.lang.Object
   ↳ java.util.AbstractCollection<T>
     ↳ java.util.AbstractList<T>
       ↳ java.util.ArrayList<T>
         ↳ android.databinding.ObservableArrayList<T>

Class Overview

An ObservableList implementation using ArrayList as an implementation.

Summary

[Expand]
Inherited Fields
From class java.util.AbstractList
Public Constructors
ObservableArrayList()
Public Methods
boolean add(T object)
Adds the specified object at the end of this ArrayList.
void add(int index, T object)
Inserts the specified object into this ArrayList at the specified location.
boolean addAll(int index, Collection<? extends T> collection)
Inserts the objects in the specified collection at the specified location in this List.
boolean addAll(Collection<? extends T> collection)
Adds the objects in the specified collection to this ArrayList.
void addOnListChangedCallback(OnListChangedCallback listener)
void clear()
Removes all elements from this ArrayList, leaving it empty.
T remove(int index)
Removes the object at the specified location from this list.
boolean remove(Object object)
Removes one instance of the specified object from this Collection if one is contained (optional).
void removeOnListChangedCallback(OnListChangedCallback listener)
T set(int index, T object)
Replaces the element at the specified location in this ArrayList with the specified object.
Protected Methods
void removeRange(int fromIndex, int toIndex)
Removes the objects in the specified range from the start to the end index minus one.
[Expand]
Inherited Methods
From class java.util.ArrayList
From class java.util.AbstractList
From class java.util.AbstractCollection
From class java.lang.Object
From interface java.util.List
From interface java.util.Collection
From interface android.databinding.ObservableList
From interface java.lang.Iterable
From interface java.util.List

Public Constructors

public ObservableArrayList ()

Public Methods

public boolean add (T object)

Adds the specified object at the end of this ArrayList.

Parameters
object the object to add.
Returns
  • always true

public void add (int index, T object)

Inserts the specified object into this ArrayList at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this ArrayList, the object is added at the end.

Parameters
index the index at which to insert the object.
object the object to add.

public boolean addAll (int index, Collection<? extends T> collection)

Inserts the objects in the specified collection at the specified location in this List. The objects are added in the order they are returned from the collection's iterator.

Parameters
index the index at which to insert.
collection the collection of objects.
Returns
  • true if this ArrayList is modified, false otherwise.

public boolean addAll (Collection<? extends T> collection)

Adds the objects in the specified collection to this ArrayList.

Parameters
collection the collection of objects.
Returns
  • true if this ArrayList is modified, false otherwise.

public void addOnListChangedCallback (OnListChangedCallback listener)

public void clear ()

Removes all elements from this ArrayList, leaving it empty.

public T remove (int index)

Removes the object at the specified location from this list.

Parameters
index the index of the object to remove.
Returns
  • the removed object.

public boolean remove (Object object)

Removes one instance of the specified object from this Collection if one is contained (optional). This implementation iterates over this Collection and tests for each element e returned by the iterator, whether e is equal to the given object. If object != null then this test is performed using object.equals(e), otherwise using object == null. If an element equal to the given object is found, then the remove method is called on the iterator and true is returned, false otherwise. If the iterator does not support removing elements, an UnsupportedOperationException is thrown.

Parameters
object the object to remove.
Returns
  • true if this Collection is modified, false otherwise.

public void removeOnListChangedCallback (OnListChangedCallback listener)

public T set (int index, T object)

Replaces the element at the specified location in this ArrayList with the specified object.

Parameters
index the index at which to put the specified object.
object the object to add.
Returns
  • the previous element at the index.

Protected Methods

protected void removeRange (int fromIndex, int toIndex)

Removes the objects in the specified range from the start to the end index minus one.

Parameters
fromIndex the index at which to start removing.
toIndex the index after the last element to remove.