code: public static <S, I> boolean isPrefixClosed(DFA<S, I> dfa, Alphabet<I> alphabet) {
          return dfa.getStates()
                    .parallelStream()
                    .allMatch(s -> dfa.isAccepting(s) ||
                                   alphabet.parallelStream().noneMatch(i -> dfa.isAccepting(dfa.getSuccessors(s, i))));
      }
docs: Computes whether the language of the given DFA is prefix-closed.
  
  Assumes all states in the given {@link DFA} are reachable from the initial state.
  
  @param dfa the DFA to check
  @param alphabet the Alphabet
  @param <S> the type of state
  @param <I> the type of input
  
  @return whether the DFA is prefix-closed.