Java Collection Equal isEqual(Collection coll, Comparator comp)

Here you can find the source of isEqual(Collection coll, Comparator comp)

Description

is Equal

License

Open Source License

Declaration

public static <T extends Object> boolean isEqual(Collection<? extends T> coll, Comparator<? super T> comp) 

Method Source Code

//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();/*from   ww w  .j ava  2 s.  c om*/
        while (i.hasNext()) {
            T next = i.next();
            if (comp.compare(first, next) < 0) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. isCollectionEqual(Collection c1, Collection c2)
  2. isCollectionsEqual(Collection f1, Collection f2)
  3. isContentEqual(final Collection collectionA, final Collection collectionB)
  4. isEqual(Collection left, Collection right)
  5. isEqual(Collection one, Collection two)
  6. isEqual(Collection a, Collection b)
  7. isEqualBasicCol(Collection col1, Collection col2)
  8. isEqualCollection(final Collection a, final Collection b)
  9. isEqualCollection(final Collection a, final Collection b)