Ancestor { static <S> Ancestor<S> createInitial(Iterable<S> states, @Nullable BiFunction<S, S, Bigram<S>> bigramProvider) { HistoryChain<S> history = null; boolean atLeastOne = false; for (S state : states) { atLeastOne = true; history = new HistoryChain<>(history, state); } if (!atLeastOne) { throw new IllegalArgumentException("there should be at least one initial state"); } return new Ancestor<>(0.0, history, bigramProvider); } private  Ancestor(double logProbability,
      HistoryChain<S> historyChain,
      @Nullable BiFunction<S, S, Bigram<S>> bigramProvider);   }
@Test void testCreateInitialFailure() { List<String> initialStates = new ArrayList<>(); assertThrows(IllegalArgumentException.class, () -> Ancestor.createInitial(initialStates, Ngram::create)); }