
aQute.lib.collections.Logic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biz.aQute.bnd.runtime.snapshot Show documentation
Show all versions of biz.aQute.bnd.runtime.snapshot Show documentation
biz.aQute.bnd.runtime.snapshot
The newest version!
package aQute.lib.collections;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
public class Logic {
private Logic() {}
@SafeVarargs
public static Collection retain(Collection extends T> first, Collection extends T>... sets) {
Set result = new HashSet<>(first);
for (Collection extends T> set : sets) {
result.retainAll(set);
}
return result;
}
@SafeVarargs
public static Collection remove(Collection extends T> first, Collection extends T>... sets) {
Set result = new HashSet<>(first);
for (Collection extends T> set : sets) {
result.removeAll(set);
}
return result;
}
@SafeVarargs
public static boolean hasOverlap(Collection extends T> source, Collection extends T>... toBeChecked) {
for (T t : source) {
for (Collection extends T> l : toBeChecked) {
for (T r : l) {
if (t.equals(r))
return true;
}
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy