public AutoComplete union ( AutoComplete other ) { if ( possibilities . isEmpty ( ) ) { return other ; } if ( other . possibilities . isEmpty ( ) ) { return this ; } // TODO: Make sure this can't happen. if ( ! this . prefix . equals ( other . prefix ) ) { throw new IllegalArgumentException ( "Trying to perform union on different prefixes: prefix1='" + this . prefix + "', prefix2='" + other . prefix + ' ' ) ; } final Trie < CliValueType > unifiedPossibilities = this . possibilities . union ( other . possibilities ) ; return new AutoComplete ( prefix , unifiedPossibilities ) ; }
Create a new auto - complete by merging this auto - complete with the given auto - complete . The resulting auto - complete will contain possibilities from both this and the given auto - complete .