public class WeakObserverList<T> extends ObserverList<T>
ObserverList
equivalent that does not prevent added observers from being
garbage-collected.ObserverList.ObserverOp<T>, ObserverList.Policy
FAST_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, newList
public 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)
ObserverList
add
in class ObserverList<T>
public boolean add(T element)
ObserverList
add
in class ObserverList<T>
public boolean remove(T element)
ObserverList
remove
in class ObserverList<T>
public void apply(ObserverList.ObserverOp<T> obop)
ObserverList
apply
in class ObserverList<T>
public int size()
ObserverList
size
in class ObserverList<T>
public void clear()
ObserverList
clear
in class ObserverList<T>
public WeakObserverList<T> setCheckDuplicates(boolean checkDuplicates)
ObserverList
setCheckDuplicates
in class ObserverList<T>
public void prune()
Copyright © 2015. All rights reserved.