/** * Checks if this bundle contains any key from the specified bundle. * * @param bundle the bundle to search for, not null * @return true if this bundle contains any key from the specified bundle */ public boolean containsAny(IdentifierBundleWithDates bundle) { ArgumentChecker.notNull(bundle, "bundle"); for (IdentifierWithDates identifier : bundle.getIdentifiers()) { if (_identifiers.contains(identifier)) { return true; } } return false; }
// ------------------------------------------------------------------- @Override public int compareTo(IdentifierBundleWithDates other) { final Set<IdentifierWithDates> mySet = getIdentifiers(); final Set<IdentifierWithDates> otherSet = other.getIdentifiers(); if (mySet.size() < otherSet.size()) { return -1; } if (mySet.size() > otherSet.size()) { return 1; } final List<IdentifierWithDates> myList = new ArrayList<IdentifierWithDates>(mySet); // already sorted as TreeSet final List<IdentifierWithDates> otherList = new ArrayList<IdentifierWithDates>(otherSet); // already sorted as TreeSet for (int i = 0; i < myList.size(); i++) { int c = myList.get(i).compareTo(otherList.get(i)); if (c != 0) { return c; } } return 0; }