Here you can find the source of containsIdentity(Collection> objects, Object object)
public static boolean containsIdentity(Collection<?> objects, Object object)
//package com.java2s; /******************************************************************************* * Copyright (c) 2007, 2008 Tran Nam Quang. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*www . j a v a 2 s . c om*/ * Tran Nam Quang - initial API and implementation *******************************************************************************/ import java.util.Collection; public class Main { /** * Returns true if <tt>objects</tt> contains <tt>object</tt>. */ public static boolean containsIdentity(Object[] objects, Object object) { for (Object candidate : objects) if (candidate == object) return true; return false; } /** * Returns true if <tt>objects</tt> contains <tt>object</tt>. */ public static boolean containsIdentity(Collection<?> objects, Object object) { for (Object candidate : objects) if (candidate == object) return true; return false; } }