code: public static ModifiableDBIDs union(DBIDs ids1, DBIDs ids2) {
      ModifiableDBIDs result = DBIDUtil.newHashSet(Math.max(ids1.size(), ids2.size()));
      result.addDBIDs(ids1);
      result.addDBIDs(ids2);
      return result;
    }
docs: Returns the union of the two specified collection of IDs.
  
  @param ids1 the first collection
  @param ids2 the second collection
  @return the union of ids1 and ids2 without duplicates