@ Override @ Deprecated public Set < String > keySet ( ) { // TODO: Java 6 ResourceBundle has keySet() which calls handleKeySet() // and caches the results. // When we upgrade to Java 6, we still need to check for isTopLevelResource(). // Keep the else branch as is. The if body should just return super.keySet(). // Remove then-redundant caching of the keys. Set < String > keys = null ; ICUResourceBundle icurb = null ; if ( isTopLevelResource ( ) && this instanceof ICUResourceBundle ) { // We do not cache the top-level keys in this base class so that // not every string/int/binary... resource has to have a keys cache field. icurb = ( ICUResourceBundle ) this ; keys = icurb . getTopLevelKeySet ( ) ; } if ( keys == null ) { if ( isTopLevelResource ( ) ) { TreeSet < String > newKeySet ; if ( parent == null ) { newKeySet = new TreeSet < String > ( ) ; } else if ( parent instanceof UResourceBundle ) { newKeySet = new TreeSet < String > ( ( ( UResourceBundle ) parent ) . keySet ( ) ) ; } else { // TODO: Java 6 ResourceBundle has keySet(); use it when we upgrade to Java 6 // and remove this else branch. newKeySet = new TreeSet < String > ( ) ; Enumeration < String > parentKeys = parent . getKeys ( ) ; while ( parentKeys . hasMoreElements ( ) ) { newKeySet . add ( parentKeys . nextElement ( ) ) ; } } newKeySet . addAll ( handleKeySet ( ) ) ; keys = Collections . unmodifiableSet ( newKeySet ) ; if ( icurb != null ) { icurb . setTopLevelKeySet ( keys ) ; } } else { return handleKeySet ( ) ; } } return keys ; }
Returns a Set of all keys contained in this ResourceBundle and its parent bundles .