private void checkState(final boolean usesMiddles) throws IllegalStateException {
  if (beginnings == null) {
    throw new IllegalStateException("The list of beginnings is null.");
  }
  if (usesMiddles && middles == null) {
    throw new IllegalStateException("The list of middles is null.");
  }
  if (endings == null) {
    throw new IllegalStateException("The list of endings is null.");
  }
  if (beginnings.size() == 0) {
    throw new IllegalStateException("The list of beginnings is empty.");
  }
  if (usesMiddles && middles.size() == 0) {
    throw new IllegalStateException("The list of middles is empty.");
  }
  if (endings.size() == 0) {
    throw new IllegalStateException("The list of endings is empty.");
  }
}

private void checkState ( final boolean usesMiddles ) throws IllegalStateException { if ( beginnings == null ) { throw new IllegalStateException ( "The list of beginnings is null." ) ; } if ( usesMiddles && middles == null ) { throw new IllegalStateException ( "The list of middles is null." ) ; } if ( endings == null ) { throw new IllegalStateException ( "The list of endings is null." ) ; } if ( beginnings . size ( ) == 0 ) { throw new IllegalStateException ( "The list of beginnings is empty." ) ; } if ( usesMiddles && middles . size ( ) == 0 ) { throw new IllegalStateException ( "The list of middles is empty." ) ; } if ( endings . size ( ) == 0 ) { throw new IllegalStateException ( "The list of endings is empty." ) ; } }
checks the current state of the builder for any issue with it ' s state . if no issue is found , then no exception is thrown .
