Class PredicatedNavigableSet<E>

  • Type Parameters:
    E - the type of the elements in this set
    All Implemented Interfaces:
    Serializable, Iterable<E>, Collection<E>, NavigableSet<E>, Set<E>, SortedSet<E>

    public class PredicatedNavigableSet<E>
    extends PredicatedSortedSet<E>
    implements NavigableSet<E>
    Decorates another NavigableSet to validate that all additions match a specified predicate.

    This set exists to provide validation for the decorated set. It is normally created to decorate an empty set. If an object cannot be added to the set, an IllegalArgumentException is thrown.

    One usage would be to ensure that no null entries are added to the set.

     NavigableSet set =
       PredicatedSortedSet.predicatedNavigableSet(new TreeSet(),
                                                  NotNullPredicate.notNullPredicate());
     
    Since:
    4.1
    See Also:
    Serialized Form