Returns the first item that matches the supplied predicate or null if no items in this model
matches the predicate.
763457
public T findItem (Predicate<T> p)
    {
        if (_items == null) {
            return null;
        }
        for (T item : _items) {
            if (p.apply(item)) {
                return item;
            }
        }
        return null;
    }
67048
public final AbstractItem findFirstMatching(Filter filter) throws MessageStoreException
    {
        AbstractItem item = null;
        for (int priority = Priorities.HIGHEST_PRIORITY; null == item
                && priority >= Priorities.LOWEST_PRIORITY; priority--)
        {
            LinkedList tl = _prioritySublists[priority];
            if (null != tl)
            {
                item = tl.findFirstMatching(filter);
            }
        }
        return item;
    }
544769
public static <E> Optional<E> find(final Iterable<E> iterable, final Predicate<E> pred) {
        for (E element : iterable) {
            if (pred.test(element)) {
                return Optional.of(element);
            }
        }
        return Optional.absent();
    }
997597
public static <T> Collector<T, ?, Boolean> anyMatch(Predicate<? super T> predicate) {
        return collectingAndThen(noneMatch(predicate), t -> !t);
    }
230106
public static Measurement first(Iterable<Measurement> ms, Predicate<Measurement> p) {
    Iterator<Measurement> it = filter(ms, p).iterator();
    return it.hasNext() ? it.next() : null;
  }
665460
public T getFirst() {
        Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst();
        return retval.isPresent()? retval.get().getValue() : null;
    }
1006380
public function first()
    {
        if (empty($this->data)) {
            throw new OutOfBoundsException('Can\'t determine first item. Collection is empty');
        }

        \reset($this->data);

        return \current($this->data);
    }
1015681
def first_with(self, x):
        """"""

        def _find(x):
            try:
                for arg in self.all:
                    if x in arg:
                        return self.all.index(arg)
            except ValueError:
                return None

        if is_collection(x):
            for item in x:
                found = _find(item)
                if found:
                    return found
            return None
        else:
            return _find(x)
92588
def getIndex(predicateFn: Callable[[T], bool], items: List[T]) -> int:
    
    try:
        return next(i for i, v in enumerate(items) if predicateFn(v))
    except StopIteration:
        return -1
983104
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second) {
		return new OrPredicate<>(Predicates.<T> asList(Objects.requireNonNull(first), Objects.requireNonNull(second)));
	}
264830
public TemplateFilter where(Predicate<TemplateMetadata> predicate) {
        checkNotNull(predicate, "Predicate must be not a null");

        this.predicate = this.predicate.and(predicate);

        return this;
    }
101616
public static <T> T first(List<T> items) {
        if(items != null && items.size() > 0) {
            return items.get(0);
        }

        return null;
    }
720774
def where(self, predicate):
        
        if predicate is None:
            raise NullArgumentError("No predicate given for where clause")
        return Enumerable(itertools.ifilter(predicate, self))
1139276
public QueryResult<T> first() {
        if (response != null && response.size() > 0) {
            return response.get(0);
        }
        return null;
    }
543070
public static <T> T getFirst(Iterable<T> iterable) {
		if (null != iterable) {
			return getFirst(iterable.iterator());
		}
		return null;
	}
206667
public static <T, P> T detectWithIfNone(
            Iterable<T> iterable,
            Predicate2<? super T, ? super P> predicate,
            P parameter,
            T ifNone)
    {
        T result = Iterate.detectWith(iterable, predicate, parameter);
        return result == null ? ifNone : result;
    }
884510
function findPrevNode(firstNode, item, comparer) {
    let ret;
    let prevNode = firstNode;
    // while item > prevNode.value
    while (prevNode != undefined && comparer(prevNode.value, item) > 0) {
        ret = prevNode;
        prevNode = prevNode.next;
    }
    return ret;
}