Android Utililty Methods Collection Contains

List of utility methods to do Collection Contains

Description

The list of methods to do Collection Contains are organized into topic(s).

Method

booleancontains(Collection collection, T value)
Answers true if a predicate is true for at least one element of a collection.
return collection != null && collection.size() > 0 ? collection
        .contains(value) : false;
booleancontainsInstance(Collection collection, Object element)
Check whether the given Collection contains the given element instance.
if (collection != null) {
    for (Object candidate : collection) {
        if (candidate == element) {
            return true;
return false;
...
booleancontainsInstance(Collection collection, Object element)
Check whether the given Collection contains the given element instance.
if (collection != null) {
    for (Object candidate : collection) {
        if (candidate == element) {
            return true;
return false;
...