| org.apache.commons.collections.collection.PredicatedCollection org.apache.commons.collections.list.PredicatedList
PredicatedList | public class PredicatedList extends PredicatedCollection implements List(Code) | | Decorates another List to validate that all additions
match a specified predicate.
This list exists to provide validation for the decorated list.
It is normally created to decorate an empty list.
If an object cannot be added to the list, an IllegalArgumentException is thrown.
One usage would be to ensure that no null entries are added to the list.
List list = PredicatedList.decorate(new ArrayList(), NotNullPredicate.INSTANCE);
This class is Serializable from Commons Collections 3.1.
since: Commons Collections 3.0 version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $ author: Stephen Colebourne author: Paul Jack |
PredicatedList | protected PredicatedList(List list, Predicate predicate)(Code) | | Constructor that wraps (not copies).
If there are any elements already in the list being decorated, they
are validated.
Parameters: list - the list to decorate, must not be null Parameters: predicate - the predicate to use for validation, must not be null throws: IllegalArgumentException - if list or predicate is null throws: IllegalArgumentException - if the list contains invalid elements |
decorate | public static List decorate(List list, Predicate predicate)(Code) | | Factory method to create a predicated (validating) list.
If there are any elements already in the list being decorated, they
are validated.
Parameters: list - the list to decorate, must not be null Parameters: predicate - the predicate to use for validation, must not be null throws: IllegalArgumentException - if list or predicate is null throws: IllegalArgumentException - if the list contains invalid elements |
getList | protected List getList()(Code) | | Gets the list being decorated.
the decorated list |
subList | public List subList(int fromIndex, int toIndex)(Code) | | |
Fields inherited from org.apache.commons.collections.collection.PredicatedCollection | final protected Predicate predicate(Code)(Java Doc)
|
|
|