Here you can find the source of contains(Collection coll, Object o, Comparator c)
Parameter | Description |
---|---|
coll | a parameter |
o | a parameter |
c | a parameter |
public static boolean contains(Collection coll, Object o, Comparator c)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**//from w w w.j a v a2s . co m * 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; } }