public SortedMap < String , String > getDisplayNames ( ULocale locale , Comparator < Object > com , String matchID ) { SortedMap < String , String > dncache = null ; LocaleRef ref = dnref ; if ( ref != null ) { dncache = ref . get ( locale , com ) ; } while ( dncache == null ) { synchronized ( this ) { if ( ref == dnref || dnref == null ) { dncache = new TreeMap < String , String > ( com ) ; // sorted Map < String , Factory > m = getVisibleIDMap ( ) ; Iterator < Entry < String , Factory > > ei = m . entrySet ( ) . iterator ( ) ; while ( ei . hasNext ( ) ) { Entry < String , Factory > e = ei . next ( ) ; String id = e . getKey ( ) ; Factory f = e . getValue ( ) ; dncache . put ( f . getDisplayName ( id , locale ) , id ) ; } dncache = Collections . unmodifiableSortedMap ( dncache ) ; dnref = new LocaleRef ( dncache , locale , com ) ; } else { ref = dnref ; dncache = ref . get ( locale , com ) ; } } } Key matchKey = createKey ( matchID ) ; if ( matchKey == null ) { return dncache ; } SortedMap < String , String > result = new TreeMap < String , String > ( dncache ) ; Iterator < Entry < String , String > > iter = result . entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Entry < String , String > e = iter . next ( ) ; if ( ! matchKey . isFallbackOf ( e . getValue ( ) ) ) { iter . remove ( ) ; } } return result ; }
Return a snapshot of the mapping from display names to visible IDs for this service . This set will not change as factories are added or removed but the supported ids will so there is no guarantee that all and only the ids in the returned map will be visible and supported by the service in subsequent calls nor is there any guarantee that the current display names match those in the set . The display names are sorted based on the comparator provided .