Package org.openstreetmap.josm.tools
Class ListeningCollection<T>
- java.lang.Object
-
- java.util.AbstractCollection<T>
-
- org.openstreetmap.josm.tools.ListeningCollection<T>
-
- Type Parameters:
T- The entry type
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>
public class ListeningCollection<T> extends java.util.AbstractCollection<T>
This is a proxy of a collection that notifies a listener on every collection change- Since:
- 12267 (extracted from GpxData), 12156
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<T>baseprivate java.lang.RunnablerunOnModification
-
Constructor Summary
Constructors Constructor Description ListeningCollection(java.util.List<T> base, java.lang.Runnable runOnModification)Constructs a newListeningCollection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T e)protected voidadded(T object)Called when an object is added.java.util.Iterator<T>iterator()booleanremove(java.lang.Object o)protected voidremoved(T object)Called when an object is removed.intsize()-
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
runOnModification
private final java.lang.Runnable runOnModification
-
-
Constructor Detail
-
ListeningCollection
public ListeningCollection(java.util.List<T> base, java.lang.Runnable runOnModification)
Constructs a newListeningCollection.- Parameters:
base- base collectionrunOnModification- runnable run at each modification- Since:
- 12269
-
-
Method Detail
-
size
public final int size()
-
remove
public final boolean remove(java.lang.Object o)
-
removed
protected void removed(T object)
Called when an object is removed.- Parameters:
object- the removed object
-
-