boolean (List<VariableInfo> toAdd, VariableInfo[] outputVars) { if (toAdd.size() != outputVars.length) return false; Set<String> names = new HashSet<>(); for (VariableInfo info : toAdd) { names.add(info.getName()); } for (VariableInfo var : outputVars) { if (!names.contains(var.getName())) return false; } return true; }