--- a/jdk/src/share/classes/sun/management/GarbageCollectorImpl.java Tue Jan 17 14:10:04 2012 +0000
+++ b/jdk/src/share/classes/sun/management/GarbageCollectorImpl.java Tue Jan 17 15:55:40 2012 -0800
@@ -70,14 +70,11 @@
private String[] poolNames = null;
synchronized String[] getAllPoolNames() {
if (poolNames == null) {
- List pools = ManagementFactory.getMemoryPoolMXBeans();
+ List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
poolNames = new String[pools.size()];
int i = 0;
- for (ListIterator iter = pools.listIterator();
- iter.hasNext();
- i++) {
- MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
- poolNames[i] = p.getName();
+ for (MemoryPoolMXBean m : pools) {
+ poolNames[i++] = m.getName();
}
}
return poolNames;