Here you can find the source of containsObject(Collection
public static <T> boolean containsObject(Collection<T> c, T o)
//package com.java2s; import java.util.*; public class Main { /**/*from w w w . j av a 2 s. co m*/ * Checks whether a Collection contains a specified Object. Object equality * (==), rather than .equals(), is used. */ public static <T> boolean containsObject(Collection<T> c, T o) { for (Object o1 : c) { if (o == o1) { return true; } } return false; } }