Decorates another Bag to validate that additions
match a specified predicate.
This bag exists to provide validation for the decorated bag.
It is normally created to decorate an empty bag.
If an object cannot be added to the bag, an IllegalArgumentException is thrown.
One usage would be to ensure that no null entries are added to the bag.
Bag bag = PredicatedBag.decorate(new HashBag(), 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 |