Here you can find the source of contains(Set
public static boolean contains(Set<String> setTocheck, Set<String> mustHaveAllThese)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static boolean contains(Set<String> setTocheck, Set<String> mustHaveAllThese) { for (String s : mustHaveAllThese) {//iterate over all must have tags. if (!setTocheck.contains(s)) {//return immediately when item not found in setToCheck return false; }//www.ja va2 s. c o m } return true; } }