/** * Returns a new (deterministic and minimal) automaton that accepts the union of the given set of * strings. The input character sequences are internally sorted in-place, so the input array is * modified. * * @see StringUnionOperations */ public static DefaultAutomaton makeStringUnion(CharSequence... strings) { if (strings.length == 0) return makeEmpty(); Arrays.sort(strings, StringUnionOperations.LEXICOGRAPHIC_ORDER); DefaultAutomaton a = new DefaultAutomaton(); a.setInitialState(StringUnionOperations.build(strings)); a.setDeterministic(true); a.reduce(); a.recomputeHashCode(); return a; }