private void processMapping ( ) { for ( Entry < String , Set < String > > desiredToMatchingLanguages : matcherData . matchingLanguages ( ) . keyValuesSet ( ) ) { String desired = desiredToMatchingLanguages . getKey ( ) ; Set < String > supported = desiredToMatchingLanguages . getValue ( ) ; for ( R3 < ULocale , ULocale , Double > localeToMaxAndWeight : localeToMaxLocaleAndWeight ) { final ULocale key = localeToMaxAndWeight . get0 ( ) ; String lang = key . getLanguage ( ) ; if ( supported . contains ( lang ) ) { addFiltered ( desired , localeToMaxAndWeight ) ; } } } // now put in the values directly, since languages always map to themselves for ( R3 < ULocale , ULocale , Double > localeToMaxAndWeight : localeToMaxLocaleAndWeight ) { final ULocale key = localeToMaxAndWeight . get0 ( ) ; String lang = key . getLanguage ( ) ; addFiltered ( lang , localeToMaxAndWeight ) ; } }
We preprocess the data to get just the possible matches for each desired base language .