HashSet<Obligation> set2 = new HashSet<Obligation>(obs2);
// consider each Obligation in the first set, and try to find an
// equivalent one in the second set
while (it1.hasNext()) {
Obligation o1 = it1.next();
Iterator<Obligation> it2 = set2.iterator();
boolean matched = false;
// go through the second set, and see if there's a matching
// Obligation
while (it2.hasNext() && (!matched)) {
Obligation o2 = (Obligation) (it2.next());
// to be equivalent, they need to have the same identifier
// and the same fulfillOn setting
if ((o1.getId().equals(o2.getId())) && (o1.getFulfillOn() == o2.getFulfillOn())) {
// get the assignments, and make sure they match
List<Attribute> assignments1 = o1.getAssignments();
List<Attribute> assignments2 = o2.getAssignments();
if (assignments1.size() == assignments2.size()) {
Iterator<Attribute> ait1 = assignments1.iterator();
Iterator<Attribute> ait2 = assignments2.iterator();
boolean assignmentsMatch = true;