jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java
changeset 1510 e747d3193ef2
parent 1247 b4c26443dee5
child 5506 202f599c92aa
--- a/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java	Fri Oct 24 20:47:23 2008 -0700
+++ b/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java	Mon Oct 27 14:02:40 2008 +0100
@@ -30,6 +30,7 @@
 // java import
 //
 import com.sun.jmx.mbeanserver.GetPropertyAction;
+import com.sun.jmx.mbeanserver.Util;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
@@ -611,7 +612,7 @@
     @SuppressWarnings("unchecked")  // historical confusion about the return type
     public Collection<Object> values() {
 
-        return (Collection) dataMap.values() ;
+        return Util.cast(dataMap.values());
     }
 
 
@@ -647,7 +648,7 @@
     @SuppressWarnings("unchecked")  // historical confusion about the return type
     public Set<Map.Entry<Object,Object>> entrySet() {
 
-        return (Set) dataMap.entrySet();
+        return Util.cast(dataMap.entrySet());
     }
 
 
@@ -725,8 +726,7 @@
         if (this.size() != other.size()) {
             return false;
         }
-        for (Iterator iter = this.values().iterator(); iter.hasNext();  ) {
-            CompositeData value = (CompositeData) iter.next();
+        for (CompositeData value : dataMap.values()) {
             if ( ! other.containsValue(value) ) {
                 return false;
             }
@@ -760,9 +760,8 @@
         int result = 0;
 
         result += this.tabularType.hashCode();
-        for (Iterator iter = this.values().iterator(); iter.hasNext();  ) {
-            result += ((CompositeData)iter.next()).hashCode();
-        }
+        for (Object value : values())
+            result += value.hashCode();
 
         return result;