|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> org.eclipse.emf.validation.util.FilteredCollection<E>
E
- the collection element typepublic class FilteredCollection<E>
Wrapper for a Java 2 Collection
that provides a filtered view of its
contents according to a client-specified filter algorithm.
Nested Class Summary | |
---|---|
static interface |
FilteredCollection.Filter<E>
Interface for the algorithm that determines which elements are in and which are out of the filtered collection. |
Constructor Summary | |
---|---|
FilteredCollection(Collection<? extends E> collection,
FilteredCollection.Filter<? super E> filter)
Initializes me to filter the specified collection, obtained independently. |
Method Summary | |
---|---|
FilteredCollection.Filter<? super E> |
getFilter()
Retrieves the filter with which I was initialized. |
Iterator<E> |
iterator()
Obtains an iterator that dynamically filters out unwanted items using my filter algorithm. |
int |
size()
Computes the size of the filtered view, i.e. |
Methods inherited from class java.util.AbstractCollection |
---|
add, addAll, clear, contains, containsAll, isEmpty, 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 |
Constructor Detail |
---|
public FilteredCollection(Collection<? extends E> collection, FilteredCollection.Filter<? super E> filter)
Initializes me to filter the specified collection, obtained independently.
Note that it is a very bad idea to modify the
wrapped collection
after creating this filtered view on it.
The results are undefined, but probably not what you want.
collection
- the collection that I am to filterfilter
- the filter algorithm to applyMethod Detail |
---|
public final FilteredCollection.Filter<? super E> getFilter()
public Iterator<E> iterator()
filter
algorithm.
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public int size()
Computes the size of the filtered view, i.e. the number of elements
in the original collection that match my filter
, by
iterating myself.
Note that my size is recounted every time that it is requested, in case my filter's algorithm is changed or the contents of the underlying collection are changed.
size
in interface Collection<E>
size
in class AbstractCollection<E>
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |