Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /** * Answer whether or not coll contains Object o, * but not based on equal(), but on compareTo()==0 * @param coll * @param o * @param c * @return */ public static boolean contains(Collection coll, Object o, Comparator c) { boolean answer = false; for (Iterator i = coll.iterator(); i.hasNext() && !answer;) { answer = 0 == c.compare(o, i.next()); } return answer; } }