Here you can find the source of containsSafe(Collection
public static <V> boolean containsSafe(Collection<V> collection, V value)
//package com.java2s; // under the terms of the Eclipse Public License v1.0 which accompanies import java.util.Collection; public class Main { /**/* w w w .j a va 2 s . c om*/ * Type-safe wrapper for {@link Collection#contains(Object)} method. It restricts * type of a value and makes sure that you do not call method for the value * wrong type. */ public static <V> boolean containsSafe(Collection<V> collection, V value) { return collection.contains(value); } }