jdk/src/share/classes/java/util/prefs/XmlSupport.java
changeset 11274 7e7196757acd
parent 5506 202f599c92aa
child 14014 da3648e13e67
--- a/jdk/src/share/classes/java/util/prefs/XmlSupport.java	Tue Dec 06 10:14:02 2011 -0800
+++ b/jdk/src/share/classes/java/util/prefs/XmlSupport.java	Wed Dec 07 12:12:50 2011 -0800
@@ -106,7 +106,7 @@
         xmlRoot.setAttribute("type", (p.isUserNode() ? "user" : "system"));
 
         // Get bottom-up list of nodes from p to root, excluding root
-        List ancestors = new ArrayList();
+        List<Preferences> ancestors = new ArrayList<>();
 
         for (Preferences kid = p, dad = kid.parent(); dad != null;
                                    kid = dad, dad = kid.parent()) {
@@ -116,7 +116,7 @@
         for (int i=ancestors.size()-1; i >= 0; i--) {
             e.appendChild(doc.createElement("map"));
             e = (Element) e.appendChild(doc.createElement("node"));
-            e.setAttribute("name", ((Preferences)ancestors.get(i)).name());
+            e.setAttribute("name", ancestors.get(i).name());
         }
         putPreferencesInXml(e, doc, p, subTree);
 
@@ -339,17 +339,17 @@
      * @throws IOException if writing to the specified output stream
      *         results in an <tt>IOException</tt>.
      */
-    static void exportMap(OutputStream os, Map map) throws IOException {
+    static void exportMap(OutputStream os, Map<String, String> map) throws IOException {
         Document doc = createPrefsDoc("map");
         Element xmlMap = doc.getDocumentElement( ) ;
         xmlMap.setAttribute("MAP_XML_VERSION", MAP_XML_VERSION);
 
-        for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) {
-            Map.Entry e = (Map.Entry) i.next();
+        for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext(); ) {
+            Map.Entry<String, String> e = i.next();
             Element xe = (Element)
                 xmlMap.appendChild(doc.createElement("entry"));
-            xe.setAttribute("key",   (String) e.getKey());
-            xe.setAttribute("value", (String) e.getValue());
+            xe.setAttribute("key",   e.getKey());
+            xe.setAttribute("value", e.getValue());
         }
 
         writeDoc(doc, os);
@@ -368,7 +368,7 @@
      * @throws InvalidPreferencesFormatException Data on input stream does not
      *         constitute a valid XML document with the mandated document type.
      */
-    static void importMap(InputStream is, Map m)
+    static void importMap(InputStream is, Map<String, String> m)
         throws IOException, InvalidPreferencesFormatException
     {
         try {