public class WeakObserverList<T> extends ObserverList<T>
ObserverList equivalent that does not prevent added observers from being
garbage-collected.ObserverList.ObserverOp<T>, ObserverList.PolicyFAST_UNSAFE_NOTIFY, SAFE_IN_ORDER_NOTIFY| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int index,
T element)
Adds an observer at the specified index.
|
boolean |
add(T element)
Adds an observer to the end of the list.
|
void |
apply(ObserverList.ObserverOp<T> obop)
Applies the supplied observer operation to all observers in the list in a manner conforming
to the notification ordering policy specified at construct time.
|
void |
clear()
Clears all observers from the list.
|
static <T> WeakObserverList<T> |
newFastUnsafe()
Creates a list with
ObserverList.Policy.FAST_UNSAFE notification policy. |
static <T> WeakObserverList<T> |
newList(ObserverList.Policy notifyPolicy)
Creates a weak observer list with the specified notification policy.
|
static <T> WeakObserverList<T> |
newSafeInOrder()
Creates a list with
ObserverList.Policy.SAFE_IN_ORDER notification policy. |
void |
prune()
Removes all garbage-collected observers from the list.
|
boolean |
remove(T element)
Removes the specified observer from the list.
|
WeakObserverList<T> |
setCheckDuplicates(boolean checkDuplicates)
Configures this observer list to check duplicates when adding observers, or not.
|
int |
size()
Returns the number of observers in this list.
|
isEmpty, newListpublic static <T> WeakObserverList<T> newSafeInOrder()
ObserverList.Policy.SAFE_IN_ORDER notification policy.public static <T> WeakObserverList<T> newFastUnsafe()
ObserverList.Policy.FAST_UNSAFE notification policy.public static <T> WeakObserverList<T> newList(ObserverList.Policy notifyPolicy)
public boolean add(int index,
T element)
ObserverListadd in class ObserverList<T>public boolean add(T element)
ObserverListadd in class ObserverList<T>public boolean remove(T element)
ObserverListremove in class ObserverList<T>public void apply(ObserverList.ObserverOp<T> obop)
ObserverListapply in class ObserverList<T>public int size()
ObserverListsize in class ObserverList<T>public void clear()
ObserverListclear in class ObserverList<T>public WeakObserverList<T> setCheckDuplicates(boolean checkDuplicates)
ObserverListsetCheckDuplicates in class ObserverList<T>public void prune()
Copyright © 2015. All rights reserved.