public static <T> boolean elementIsContainedInList(T element, Collection<T> values) {
    if (element != null && values != null) {
      return values.contains(element);
    }
    else {
      return false;
    }
  }
public static < T > boolean elementIsContainedInList ( T element , Collection < T > values ) { if ( element != null && values != null ) { return values . contains ( element ) ; } else { return false ; } }
Checks if the element is contained within the list of values.

@param element to check
@param values to check in
@param <T> the type of the element
@return {@code true} if the element and values are not {@code null} and the values contain the element,
{@code false} otherwise