01: package uk.co.jezuk.mango.algorithms;
02:
03: import uk.co.jezuk.mango.iterators.SkippingIterator;
04: import java.util.Iterator;
05:
06: /**
07: * Searchs the sequence traversed by the Iterator and returns the first
08: * object encountered for which the Predicate returns <code>false</code>.
09: * @see Find
10: * @see FindIf
11: * @version $Id: FindIfNot.java 97 2004-05-26 08:35:52Z jez $
12: */
13: public class FindIfNot {
14: static public Object execute(java.util.Iterator iterator,
15: uk.co.jezuk.mango.Predicate test) {
16: if ((iterator == null) || (test == null))
17: return null;
18:
19: Iterator filter = new SkippingIterator(iterator, test);
20: return filter.hasNext() ? filter.next() : null;
21: } // execute
22:
23: private FindIfNot() {
24: }
25: } // FindIfNot
|