code: public void intersection(Formats other, Formats intersection) {
          intersection.list.clear();
          for (Format f1 : list) {
              for (Format f2 : other.list) {
                  if (f1.matches(f2)) intersection.list.add(f2);
              }
          }
      }
docs: Find the intersection between this collection and other
  
  @param other the other collection
  @param intersection the resulting collection.