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.public class SubclassFilteredCollection<S,T extends S> extends java.util.AbstractCollection<T>
| Modifier and Type | Class and Description |
|---|---|
private class |
SubclassFilteredCollection.FilterIterator |
| Modifier and Type | Field and Description |
|---|---|
private java.util.Collection<? extends S> |
collection |
private Predicate<? super S> |
predicate |
(package private) int |
size |
| Constructor and Description |
|---|
SubclassFilteredCollection(java.util.Collection<? extends S> collection,
Predicate<? super S> predicate)
Constructs a new
SubclassFilteredCollection. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
int |
size() |
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprivate final java.util.Collection<? extends S> collection
int size
public SubclassFilteredCollection(java.util.Collection<? extends S> collection, Predicate<? super S> predicate)
SubclassFilteredCollection.collection - The base collection to filterpredicate - The predicate to use as filter