Java examples for java.util:Set Operation
check if the two sets are equal
//package com.java2s; import java.util.Set; public class Main { /**// w ww. j a v a 2s. c o m * check if the two sets are equal * * @param set1 * @param set2 * @return */ public static boolean isEqualSet(Set<String> set1, Set<String> set2) { if (set1 == null && set2 == null) { return true; } else if (set1 == null || set2 == null) { return false; } if (set1.size() != set2.size()) { return false; } return set2.containsAll(set1); } }