< prev index next >
src/com/sun/interview/Properties2.java
Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg
@@ -69,11 +69,11 @@
public Properties2(Properties2 defaults) {
this.defaults = defaults;
}
public void load(java.util.Properties source) {
- Enumeration e = source.propertyNames();
+ Enumeration<?> e = source.propertyNames();
while(e.hasMoreElements()) {
Object next = e.nextElement();
put( ((String)next), source.get(next) );
} // while
}
@@ -201,12 +201,12 @@
prnt.println(header);
}
prnt.write('#');
prnt.println(new Date());
- for (Enumeration e = keys() ; e.hasMoreElements() ;) {
- String key = (String)e.nextElement();
+ for (Enumeration<String> e = keys() ; e.hasMoreElements() ;) {
+ String key = e.nextElement();
prnt.print(key);
prnt.write('=');
String val = (String)get(key);
int len = val.length();
@@ -283,11 +283,11 @@
* @return an enumeration of all the keys in this property list, including
* the keys in the default property list.
* @see java.util.Enumeration
* @see com.sun.interview.Properties2#defaults
*/
- public Enumeration propertyNames() {
+ public Enumeration<String> propertyNames() {
Hashtable<String, Object> h = new Hashtable<>();
enumerate(h);
return h.keys();
}
@@ -305,12 +305,12 @@
*/
public void list(PrintWriter out) {
out.println("-- listing properties --");
Hashtable<String, Object> h = new Hashtable<>();
enumerate(h);
- for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
- String key = (String)e.nextElement();
+ for (Enumeration<String> e = h.keys() ; e.hasMoreElements() ;) {
+ String key = e.nextElement();
String val = (String)h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
}
out.println(key + "=" + val);
@@ -323,12 +323,12 @@
*/
private synchronized void enumerate(Hashtable<String, Object> h) {
if (defaults != null) {
defaults.enumerate(h);
}
- for (Enumeration e = keys() ; e.hasMoreElements() ;) {
- String key = (String)e.nextElement();
+ for (Enumeration<String> e = keys() ; e.hasMoreElements() ;) {
+ String key = e.nextElement();
h.put(key, get(key));
}
}
/**
< prev index next >