@@ -218,7 +218,7 @@ public class Preferences {
218
218
// data model
219
219
220
220
static Hashtable defaults ;
221
- static Hashtable table = new Hashtable (); ;
221
+ static Hashtable < String , String > table = new Hashtable < String , String >() ;
222
222
static File preferencesFile ;
223
223
224
224
@@ -242,9 +242,8 @@ static protected void init(String commandLinePrefs) {
242
242
// check for platform-specific properties in the defaults
243
243
String platformExt = "." + Base .platform .getName ();
244
244
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 ) {
248
247
if (key .endsWith (platformExt )) {
249
248
// this is a key specific to a particular platform
250
249
String actualKey = key .substring (0 , key .length () - platformExtLength );
@@ -791,12 +790,12 @@ static protected void save() {
791
790
// Fix for 0163 to properly use Unicode when writing preferences.txt
792
791
PrintWriter writer = PApplet .createWriter (preferencesFile );
793
792
794
- String [] keys = ( String []) table .keySet ().toArray (new String [0 ]);
793
+ String [] keys = table .keySet ().toArray (new String [0 ]);
795
794
Arrays .sort (keys );
796
795
for (String key : keys ) {
797
796
if (key .startsWith ("runtime." ))
798
797
continue ;
799
- writer .println (key + "=" + (( String ) table .get (key ) ));
798
+ writer .println (key + "=" + table .get (key ));
800
799
}
801
800
802
801
writer .flush ();
@@ -818,7 +817,7 @@ static protected void save() {
818
817
//}
819
818
820
819
static public String get (String attribute /*, String defaultValue */ ) {
821
- return ( String ) table .get (attribute );
820
+ return table .get (attribute );
822
821
/*
823
822
//String value = (properties != null) ?
824
823
//properties.getProperty(attribute) : applet.getParameter(attribute);
0 commit comments