Java Collection Contain containSameItems(Collection c1, Collection c2)

Here you can find the source of containSameItems(Collection c1, Collection c2)

Description

contain Same Items

License

Open Source License

Declaration

public static boolean containSameItems(Collection c1, Collection c2) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    public static boolean containSameItems(Collection c1, Collection c2) {
        Set s1 = (c1 instanceof Set) ? (Set) c1 : new HashSet(c1);
        Set s2 = (c2 instanceof Set) ? (Set) c2 : new HashSet(c2);
        return s1.equals(s2);
    }//from  w ww.  j  a  v  a2s .  c  om
}

Related

  1. containsAll(Collection coll, Collection other)
  2. containsAll(Collection collectionToCheck, Collection items)
  3. containsAll(final Collection c, final Object... array)
  4. containsAll(final Collection coll1, final Collection coll2)
  5. containSameElements(Collection> sets)
  6. containsAny(Collection c1, Collection c2)
  7. containsAny(Collection collection1, Collection collection2)
  8. containsAny(Collection container, Collection contained)
  9. containsAny(Collection col1, Collection col2)