@@ -218,7 +218,7 @@ public class Preferences {
218218 // data model
219219
220220 static Hashtable defaults ;
221- static Hashtable table = new Hashtable (); ;
221+ static Hashtable < String , String > table = new Hashtable < String , String >() ;
222222 static File preferencesFile ;
223223
224224
@@ -242,9 +242,8 @@ static protected void init(String commandLinePrefs) {
242242 // check for platform-specific properties in the defaults
243243 String platformExt = "." + Base .platform .getName ();
244244 int platformExtLength = platformExt .length ();
245- Enumeration e = table .keys ();
246- while (e .hasMoreElements ()) {
247- String key = (String ) e .nextElement ();
245+ Set <String > keySet = new HashSet <String >(table .keySet ());
246+ for (String key : keySet ) {
248247 if (key .endsWith (platformExt )) {
249248 // this is a key specific to a particular platform
250249 String actualKey = key .substring (0 , key .length () - platformExtLength );
@@ -791,12 +790,12 @@ static protected void save() {
791790 // Fix for 0163 to properly use Unicode when writing preferences.txt
792791 PrintWriter writer = PApplet .createWriter (preferencesFile );
793792
794- String [] keys = ( String []) table .keySet ().toArray (new String [0 ]);
793+ String [] keys = table .keySet ().toArray (new String [0 ]);
795794 Arrays .sort (keys );
796795 for (String key : keys ) {
797796 if (key .startsWith ("runtime." ))
798797 continue ;
799- writer .println (key + "=" + (( String ) table .get (key ) ));
798+ writer .println (key + "=" + table .get (key ));
800799 }
801800
802801 writer .flush ();
@@ -818,7 +817,7 @@ static protected void save() {
818817 //}
819818
820819 static public String get (String attribute /*, String defaultValue */ ) {
821- return ( String ) table .get (attribute );
820+ return table .get (attribute );
822821 /*
823822 //String value = (properties != null) ?
824823 //properties.getProperty(attribute) : applet.getParameter(attribute);
0 commit comments