Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Comparator; import java.util.Iterator; public class Main { public static <T extends Object> boolean isEqual(Collection<? extends T> coll, Comparator<? super T> comp) { Iterator<? extends T> i = coll.iterator(); T first = i.next(); while (i.hasNext()) { T next = i.next(); if (comp.compare(first, next) < 0) { return false; } } return true; } }