CharPriority [ ] reserveCharacters ( char [ ] chars , char [ ] reservedCharacters ) { if ( reservedCharacters == null || reservedCharacters . length == 0 ) { CharPriority [ ] result = new CharPriority [ chars . length ] ; for ( int i = 0 ; i < chars . length ; i ++ ) { result [ i ] = priorityLookupMap . get ( chars [ i ] ) ; } return result ; } Set < Character > charSet = new LinkedHashSet <> ( Chars . asList ( chars ) ) ; for ( char reservedCharacter : reservedCharacters ) { charSet . remove ( reservedCharacter ) ; } CharPriority [ ] result = new CharPriority [ charSet . size ( ) ] ; int index = 0 ; for ( char c : charSet ) { result [ index ++ ] = priorityLookupMap . get ( c ) ; } return result ; }
Provides the array of available characters based on the specified arrays .