我们最近从旧的Java代码(从WSED 5.1.2到RAD 7.5)转移,我发现旧的Enumeration引用不再适用于我们。我的新代码是否与旧代码产生相同的效果?
新代码
Enumeration numer;
Vector numVec = new Vector();
numVec.add(runtimeOptions.keys());
numer = numVec.elements();
while (numer.hasMoreElements())
{
String key = (String)numer.nextElement();
System.out.println(" "+key + "=" + (String)runtimeOptions.get(key));
}
旧代码
Enumeration enum = runtimeOptions.keys();
while(enum.hasMoreElements())
{
String key = (String)enum.nextElement();
System.out.println(" "+key + "=" + (String)runtimeOptions.get(key));
}