boolean (List<String> envTags, Set<String> taskTags) { Set<String> necessaryTags = Sets.newHashSet(taskTags); for (String tag : envTags) { necessaryTags.remove(tag.trim()); } for (String tag : taskTags) { if (tag.startsWith("-")) { //do not run on envs with that tag if (envTags.contains(tag.substring(1))) { return false; } necessaryTags.remove(tag); } } return necessaryTags.isEmpty(); }