summaryrefslogtreecommitdiff
path: root/javax
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2008-06-16 00:44:25 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2008-06-16 00:44:25 +0000
commit0141b8455dd948ddc762c0b4b95d4c3555bcde86 (patch)
tree326b067fe7f1f50c913392066f838e026dc44aa8 /javax
parent1c4f353754d7f92ddd25f64796a9d4c7d2f22513 (diff)
downloadclasspath-0141b8455dd948ddc762c0b4b95d4c3555bcde86.tar.gz
2008-06-15 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/openmbean/TabularDataSupport.java, * javax/management/openmbean/TabularType.java: Fix warnings due to use of generics.
Diffstat (limited to 'javax')
-rw-r--r--javax/management/openmbean/TabularDataSupport.java30
-rw-r--r--javax/management/openmbean/TabularType.java5
2 files changed, 15 insertions, 20 deletions
diff --git a/javax/management/openmbean/TabularDataSupport.java b/javax/management/openmbean/TabularDataSupport.java
index 1d340e86f..04eff1733 100644
--- a/javax/management/openmbean/TabularDataSupport.java
+++ b/javax/management/openmbean/TabularDataSupport.java
@@ -68,7 +68,7 @@ public class TabularDataSupport
*
* @serial the map of rows to column values.
*/
- private Map<Object,Object> dataMap;
+ private HashMap<Object,Object> dataMap;
/**
* The tabular type which represents this tabular data instance.
@@ -141,14 +141,10 @@ public class TabularDataSupport
throw new InvalidOpenTypeException("The type of the given value " +
"does not match the row type " +
"of this instance.");
- List indexNames = tabularType.getIndexNames();
- List matchingIndicies = new ArrayList(indexNames.size());
- Iterator it = indexNames.iterator();
- while (it.hasNext())
- {
- String name = (String) it.next();
- matchingIndicies.add(val.get(name));
- }
+ List<String> indexNames = tabularType.getIndexNames();
+ List<String> matchingIndicies = new ArrayList<String>(indexNames.size());
+ for (String name : indexNames)
+ matchingIndicies.add(val.get(name).toString());
return matchingIndicies.toArray();
}
@@ -173,7 +169,7 @@ public class TabularDataSupport
try
{
clone = (TabularDataSupport) super.clone();
- clone.setMap((HashMap) ((HashMap) dataMap).clone());
+ clone.setMap((HashMap<Object,Object>) dataMap.clone());
}
catch (CloneNotSupportedException e)
{
@@ -390,11 +386,11 @@ public class TabularDataSupport
*/
private boolean isKeyValid(Object[] key)
{
- Iterator it = tabularType.getIndexNames().iterator();
+ Iterator<String> it = tabularType.getIndexNames().iterator();
CompositeType rowType = tabularType.getRowType();
for (int a = 0; it.hasNext(); ++a)
{
- OpenType type = rowType.getType((String) it.next());
+ OpenType<?> type = rowType.getType(it.next());
if (!(type.isValue(key[a])))
return false;
}
@@ -496,7 +492,7 @@ public class TabularDataSupport
{
if (vals == null || vals.length == 0)
return;
- Map mapToAdd = new HashMap(vals.length);
+ Map<Object,Object> mapToAdd = new HashMap<Object,Object>(vals.length);
for (int a = 0; a < vals.length; ++a)
{
Object[] key = calculateIndex(vals[a]);
@@ -539,9 +535,9 @@ public class TabularDataSupport
{
if (m == null || m.size() == 0)
return;
- Collection vals = m.values();
+ Collection<?> vals = m.values();
CompositeData[] data = new CompositeData[vals.size()];
- Iterator it = vals.iterator();
+ Iterator<?> it = vals.iterator();
for (int a = 0; it.hasNext(); ++a)
{
data[a] = (CompositeData) it.next();
@@ -591,12 +587,12 @@ public class TabularDataSupport
}
/**
- * Package-private method to set the internal {@link java.util.Map}
+ * Private method to set the internal {@link java.util.Map}
* instance (used in cloning).
*
* @param map the new map used.
*/
- void setMap(Map map)
+ private void setMap(HashMap<Object,Object> map)
{
dataMap = map;
}
diff --git a/javax/management/openmbean/TabularType.java b/javax/management/openmbean/TabularType.java
index 9a0881e0f..5a861d061 100644
--- a/javax/management/openmbean/TabularType.java
+++ b/javax/management/openmbean/TabularType.java
@@ -206,9 +206,8 @@ public class TabularType
if (hashCode == null)
{
int elementTotal = 0;
- Iterator it = indexNames.iterator();
- while (it.hasNext())
- elementTotal += it.next().hashCode();
+ for (String s : indexNames)
+ elementTotal += s.hashCode();
hashCode = Integer.valueOf(elementTotal
+ getTypeName().hashCode()
+ rowType.hashCode());