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