Java Collection Contain containsSameItems(Collection col1, Collection col2)

Here you can find the source of containsSameItems(Collection col1, Collection col2)

Description

contains Same Items

License

Open Source License

Declaration

public static boolean containsSameItems(Collection<?> col1, Collection<?> col2) 

Method Source Code


//package com.java2s;

import java.util.ArrayList;

import java.util.Collection;

import java.util.List;

public class Main {
    public static boolean containsSameItems(Collection<?> col1, Collection<?> col2) {
        if (col1 == col2)
            return true;
        if (col1 == null || col2 == null)
            return false;
        if (col1.size() != col2.size())
            return false;
        List<Object> checkList = new ArrayList<Object>(col1);
        checkList.removeAll(col2);/*from  www. j a v a  2s .  c  o m*/
        return checkList.isEmpty();
    }
}

Related

  1. containsOne(final Collection sup, final Collection parts)
  2. containsPrefix(final Collection words, final String prefix)
  3. containsPrefix(String str, Collection prefixes)
  4. containsSafe(Collection collection, V value)
  5. containsSame(Collection first, Collection second)
  6. containsSameType(Object o, Collection collection)
  7. containsSome(Collection source, Collection target)
  8. containsSome(final Collection c1, final Collection c2)
  9. containsSome(HashSet s1, Collection other)