org.openstreetmap.josm.tools
Class SubclassFilteredCollection<S,T extends S>
java.lang.Object
java.util.AbstractCollection<T>
org.openstreetmap.josm.tools.SubclassFilteredCollection<S,T>
- Type Parameters:
S
- element type of the underlying collectionT
- element type of filtered collection (and subclass of S). The predicate
must accept only objects of type T.
- All Implemented Interfaces:
- java.lang.Iterable<T>, java.util.Collection<T>
- Direct Known Subclasses:
- FilteredCollection
public class SubclassFilteredCollection<S,T extends S>
- extends java.util.AbstractCollection<T>
Filtered view of a collection.
(read-only collection, but elements can be changed, of course)
Lets you iterate through those elements of a given collection that satisfy a
certain condition (imposed by a predicate).
Methods inherited from class java.util.AbstractCollection |
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
equals, hashCode |
collection
private final java.util.Collection<? extends S> collection
predicate
private final Predicate<? super S> predicate
size
int size
SubclassFilteredCollection
public SubclassFilteredCollection(java.util.Collection<? extends S> collection,
Predicate<? super S> predicate)
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interface java.lang.Iterable<T extends S>
- Specified by:
iterator
in interface java.util.Collection<T extends S>
- Specified by:
iterator
in class java.util.AbstractCollection<T extends S>
size
public int size()
- Specified by:
size
in interface java.util.Collection<T extends S>
- Specified by:
size
in class java.util.AbstractCollection<T extends S>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Collection<T extends S>
- Overrides:
isEmpty
in class java.util.AbstractCollection<T extends S>
JOSM