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 AbstractCollection<T>
| Modifier and Type | Class and Description |
|---|---|
private class |
SubclassFilteredCollection.FilterIterator |
| Modifier and Type | Field and Description |
|---|---|
private Collection<? extends S> |
collection |
private Predicate<? super S> |
predicate |
(package private) int |
size |
| Constructor and Description |
|---|
SubclassFilteredCollection(Collection<? extends S> collection,
Predicate<? super S> predicate) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty() |
Iterator<T> |
iterator() |
int |
size() |
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streamprivate final Collection<? extends S> collection
int size
public SubclassFilteredCollection(Collection<? extends S> collection, Predicate<? super S> predicate)
public int size()
size in interface Collection<T extends S>size in class AbstractCollection<T extends S>public boolean isEmpty()
isEmpty in interface Collection<T extends S>isEmpty in class AbstractCollection<T extends S>