blob: 75322dd35d2980ab824644199dfa75edac97f209 [file] [log] [blame]
Stuart McCulloch26e7a5a2011-10-17 10:31:43 +00001package aQute.lib.collections;
2
3import java.util.*;
4
5public class Logic {
6
7 public static <T> Collection<T> retain( Collection<T> first, Collection<T> ... sets) {
8 Set<T> result = new HashSet<T>(first);
9 for ( Collection<T> set : sets ) {
10 result.retainAll(set);
11 }
12 return result;
13 }
14
15 public static <T> Collection<T> remove( Collection<T> first, Collection<T> ... sets) {
16 Set<T> result = new HashSet<T>(first);
17 for ( Collection<T> set : sets ) {
18 result.removeAll(set);
19 }
20 return result;
21 }
22}