public class

ObservableList

extends Observable
implements List<E>
java.lang.Object
   ↳ sofia.util.Observable
     ↳ sofia.util.ObservableList<E>

Class Overview

An implementation of the List interface that is Observable and notifies its observers whenever the collection is changed.

Users of this class can add themselves as observers to an instance of this class and they will be notified when the structure of the list changes; that is, when items are added, removed, or replaced.

Summary

Public Constructors
ObservableList()
Creates a new ObservableList that is backed by an ArrayList with default capacity.
ObservableList(int capacity)
Creates a new ObservableList that is backed by an ArrayList with the specified capacity.
ObservableList(List<E> listToWrap)
Creates a new ObservableList that provides an observable view of an existing list.
ObservableList(Collection<? extends E> collection)
Creates a new ObservableList that is initialized with a copy of the data in the specified collection.
Public Methods
boolean add(E item)
void add(int index, E item)
boolean addAll(Collection<? extends E> collection)
boolean addAll(int index, Collection<? extends E> collection)
void clear()
boolean contains(Object object)
boolean containsAll(Collection<?> collection)
E get(int index)
int indexOf(Object object)
boolean isEmpty()
Iterator<E> iterator()
int lastIndexOf(Object object)
ListIterator<E> listIterator(int index)
ListIterator<E> listIterator()
E remove(int index)
boolean remove(Object object)
boolean removeAll(Collection<?> collection)
boolean retainAll(Collection<?> collection)
E set(int index, E item)
int size()
List<E> subList(int start, int end)
<T> T[] toArray(T[] array)
Object[] toArray()
[Expand]
Inherited Methods
From class sofia.util.Observable
From class java.lang.Object
From interface java.lang.Iterable
From interface java.util.Collection
From interface java.util.List

Public Constructors

public ObservableList ()

Creates a new ObservableList that is backed by an ArrayList with default capacity.

public ObservableList (int capacity)

Creates a new ObservableList that is backed by an ArrayList with the specified capacity.

Parameters
capacity the capacity of the array list

public ObservableList (List<E> listToWrap)

Creates a new ObservableList that provides an observable view of an existing list. The list passed to this constructor is not copied; changes made to the observable list will also be reflected in the list being wrapped, and vice versa.

Parameters
listToWrap the list to wrap with an observable front-end

public ObservableList (Collection<? extends E> collection)

Creates a new ObservableList that is initialized with a copy of the data in the specified collection. Since this constructor creates a copy, changes to the observable list will not be reflected in the source collection, and vice versa.

Parameters
collection the collection to be copied into the new list

Public Methods

public boolean add (E item)

public void add (int index, E item)

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

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

public void clear ()

public boolean contains (Object object)

public boolean containsAll (Collection<?> collection)

public E get (int index)

public int indexOf (Object object)

public boolean isEmpty ()

public Iterator<E> iterator ()

public int lastIndexOf (Object object)

public ListIterator<E> listIterator (int index)

public ListIterator<E> listIterator ()

public E remove (int index)

public boolean remove (Object object)

public boolean removeAll (Collection<?> collection)

public boolean retainAll (Collection<?> collection)

public E set (int index, E item)

public int size ()

public List<E> subList (int start, int end)

public T[] toArray (T[] array)

public Object[] toArray ()