code: Stream<ParameterPair> viablePairs() {
      return formals.stream()
          .flatMap(f -> actuals.stream().map(a -> ParameterPair.create(f, a)))
          .filter(
              p -> costMatrix[p.formal().index()][p.actual().index()] != Double.POSITIVE_INFINITY);
    }
docs: Constructs a stream for every element of formals paired with every element of actuals (cross
  product). Each item contains the formal and the actual, which in turn contain their index into
  the cost matrix. Elements whose cost is Inf in the cost matrix are filtered out so only viable
  pairings remain.