Here you can find the source of isSubset(Collection
Parameter | Description |
---|---|
subSet | a parameter |
superSet | a parameter |
public static <E> boolean isSubset(Collection<E> subSet, Collection<E> superSet)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**// w ww . j a v a2s .c o m * Verify if a set is subset of other set * * @param subSet * @param superSet * @return */ public static <E> boolean isSubset(Collection<E> subSet, Collection<E> superSet) { int occurrenceCount = 0; if (subSet != null && superSet != null) { for (E subSetElement : subSet) { if (superSet.contains(subSetElement)) { occurrenceCount++; } } if (occurrenceCount == subSet.size()) { return true; } } return false; } }