Java Collection Equal contentEquals(Collection list1, Collection list2)

Here you can find the source of contentEquals(Collection list1, Collection list2)

Description

content Equals

License

Open Source License

Declaration

public static <T> boolean contentEquals(Collection<T> list1, Collection<T> list2) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static <T> boolean contentEquals(Collection<T> list1, Collection<T> list2) {
        if (list1 == list2) {
            return true;
        }/*  www. ja va2  s  .  c o  m*/
        if (list1 == null || list2 == null) {
            return false;
        }
        if (list1.size() != list2.size()) {
            return false;
        }
        for (T item : list1) {
            if (!list2.contains(item))
                return false;
        }
        return true;
    }
}

Related

  1. compareTwoCollectionsEquality(Collection expectedAffectedFiles, Collection affectedFiles)
  2. containsAtleastOneEqualString(Collection left, String right)
  3. containsByEquals(Collection collection, Object obj)
  4. content_equality(Collection A, Collection B)
  5. contentEquals(Collection l1, Collection l2)
  6. equal(Collection i1, Collection i2)
  7. equal(Collection col1, Collection col2)
  8. equalCollection(Collection c1, Collection c2)
  9. equalContent(Collection col1, Collection col2)