Here you can find the source of subset(Set sub, Set sup)
Parameter | Description |
---|---|
sub | a parameter |
sup | a parameter |
public static boolean subset(Set sub, Set sup)
//package com.java2s; //The MIT License import java.util.Iterator; import java.util.Set; public class Main { /**/* w w w.ja v a2 s.c o m*/ * Checks if one set is subset of another one * * @param sub * @param sup * @return */ public static boolean subset(Set sub, Set sup) { for (Iterator i = sub.iterator(); i.hasNext();) { if (!sup.contains(i.next())) return false; } return true; } }