Here you can find the source of contains(Collection searchIn, Object[] find)
public static boolean contains(Collection searchIn, Object[] find)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static boolean contains(Collection searchIn, Object[] find) { for (Iterator iterator = searchIn.iterator(); iterator.hasNext();) { Object[] objects = (Object[]) iterator.next(); if (arraysEquals(objects, find)) { return true; }//from ww w . j a v a 2 s .c o m } return false; } private static boolean arraysEquals(Object[] mThis, Object[] mThat) { if (mThis.length == mThat.length) { for (int i = 0; i < mThis.length; i++) { if (!((mThis[i] == null) && (mThat[i] == null))) { if ((mThis[i] == null) || (mThat[i] == null) || (!mThis[i].equals(mThat[i]))) { return false; } } } return true; } else { return false; } } }