code: public static <T> void exactlyOnePresentOrIllegalArgument(
        Iterable<? extends Optional<? extends T>> optionals, final String msg) {
      if (numPresent(optionals) != 1) {
        throw new IllegalArgumentException(msg);
      }
    }
docs: Throws an {@link IllegalArgumentException} if it is not true that exactly one of the provided
  {@link Optional}s {@link Optional#isPresent()}.