Here you can find the source of containsElement(Collection
public static <T> boolean containsElement(Collection<T> collect, T elem)
//package com.java2s; import java.util.Collection; import java.util.Map; public class Main { public static <T> boolean containsElement(Collection<T> collect, T elem) { if (elem == null || isEmpty(collect)) { return false; }//from w ww .j a v a 2 s . com return collect.contains(elem); } public static <T> boolean isEmpty(Collection<T> collect) { return collect == null || collect.isEmpty(); } public static <K, V> boolean isEmpty(Map<K, V> map) { return map == null || map.isEmpty(); } }