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.
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()
|
Methods inherited from
class
sofia.util.Observable
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized
void
|
addObserver(Object observer, String method)
Adds the specified object | ||||||||||
synchronized
void
|
addObserver(Object observer)
Adds the specified object | ||||||||||
synchronized
void
|
clearObservers()
Removes all observers from the receiver.
| ||||||||||
void
|
notifyObservers(Object... arguments)
Notifies all observers of the receiver that a change has occurred affecting the state of the object. | ||||||||||
synchronized
void
|
removeObserver(Object observer, String method)
Removes the specified object's named method from the set of observers
for the receiver.
| ||||||||||
synchronized
void
|
removeObserver(Object observer)
Removes the specified object's
changeWasObserved method from the
set of observers for the receiver. |
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
Methods inherited from
interface
java.lang.Iterable
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract
Iterator<T>
|
iterator()
|
Methods inherited from
interface
java.util.Collection
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract
boolean
|
add(E arg0)
| ||||||||||
abstract
boolean
|
addAll(Collection<? extends E> arg0)
| ||||||||||
abstract
void
|
clear()
| ||||||||||
abstract
boolean
|
contains(Object arg0)
| ||||||||||
abstract
boolean
|
containsAll(Collection<?> arg0)
| ||||||||||
abstract
boolean
|
equals(Object arg0)
| ||||||||||
abstract
int
|
hashCode()
| ||||||||||
abstract
boolean
|
isEmpty()
| ||||||||||
abstract
Iterator<E>
|
iterator()
| ||||||||||
abstract
boolean
|
remove(Object arg0)
| ||||||||||
abstract
boolean
|
removeAll(Collection<?> arg0)
| ||||||||||
abstract
boolean
|
retainAll(Collection<?> arg0)
| ||||||||||
abstract
int
|
size()
| ||||||||||
abstract
<T>
T[]
|
toArray(T[] arg0)
| ||||||||||
abstract
Object[]
|
toArray()
|
Methods inherited from
interface
java.util.List
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract
boolean
|
add(E arg0)
| ||||||||||
abstract
void
|
add(int arg0, E arg1)
| ||||||||||
abstract
boolean
|
addAll(Collection<? extends E> arg0)
| ||||||||||
abstract
boolean
|
addAll(int arg0, Collection<? extends E> arg1)
| ||||||||||
abstract
void
|
clear()
| ||||||||||
abstract
boolean
|
contains(Object arg0)
| ||||||||||
abstract
boolean
|
containsAll(Collection<?> arg0)
| ||||||||||
abstract
boolean
|
equals(Object arg0)
| ||||||||||
abstract
E
|
get(int arg0)
| ||||||||||
abstract
int
|
hashCode()
| ||||||||||
abstract
int
|
indexOf(Object arg0)
| ||||||||||
abstract
boolean
|
isEmpty()
| ||||||||||
abstract
Iterator<E>
|
iterator()
| ||||||||||
abstract
int
|
lastIndexOf(Object arg0)
| ||||||||||
abstract
ListIterator<E>
|
listIterator(int arg0)
| ||||||||||
abstract
ListIterator<E>
|
listIterator()
| ||||||||||
abstract
E
|
remove(int arg0)
| ||||||||||
abstract
boolean
|
remove(Object arg0)
| ||||||||||
abstract
boolean
|
removeAll(Collection<?> arg0)
| ||||||||||
abstract
boolean
|
retainAll(Collection<?> arg0)
| ||||||||||
abstract
E
|
set(int arg0, E arg1)
| ||||||||||
abstract
int
|
size()
| ||||||||||
abstract
List<E>
|
subList(int arg0, int arg1)
| ||||||||||
abstract
<T>
T[]
|
toArray(T[] arg0)
| ||||||||||
abstract
Object[]
|
toArray()
|
Creates a new ObservableList
that is backed by an
ArrayList with default capacity.
Creates a new ObservableList
that is backed by an
ArrayList with the specified capacity.
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.
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.