OSDN Git Service

Merged gcj-eclipse branch to trunk.
[pf3gnuchains/gcc-fork.git] / libjava / classpath / java / nio / charset / Charset.java
index 3637703..556e470 100644 (file)
@@ -60,7 +60,7 @@ import java.util.TreeMap;
  * @since 1.4
  * @status updated to 1.5
  */
-public abstract class Charset implements Comparable
+public abstract class Charset implements Comparable<Charset>
 {
   private CharsetEncoder cachedEncoder;
   private CharsetDecoder cachedDecoder;
@@ -219,19 +219,20 @@ public abstract class Charset implements Comparable
     return cs;
   }
 
-  public static SortedMap availableCharsets()
+  public static SortedMap<String, Charset> availableCharsets()
   {
-    TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER);
-    for (Iterator i = provider().charsets(); i.hasNext(); )
+    TreeMap<String, Charset> charsets
+      = new TreeMap(String.CASE_INSENSITIVE_ORDER);
+    for (Iterator<Charset> i = provider().charsets(); i.hasNext(); )
       {
-       Charset cs = (Charset) i.next();
+       Charset cs = i.next();
        charsets.put(cs.name(), cs);
       }
 
     CharsetProvider[] providers = providers2();
     for (int j = 0; j < providers.length; j++)
       {
-        for (Iterator i = providers[j].charsets(); i.hasNext(); )
+        for (Iterator<Charset> i = providers[j].charsets(); i.hasNext(); )
           {
             Charset cs = (Charset) i.next();
             charsets.put(cs.name(), cs);
@@ -284,14 +285,14 @@ public abstract class Charset implements Comparable
     return canonicalName;
   }
 
-  public final Set aliases ()
+  public final Set<String> aliases ()
   {
     if (aliases == null)
-      return Collections.EMPTY_SET;
+      return Collections.<String>emptySet();
 
     // should we cache the aliasSet instead?
     int n = aliases.length;
-    HashSet aliasSet = new HashSet (n);
+    HashSet<String> aliasSet = new HashSet<String> (n);
     for (int i = 0; i < n; ++i)
         aliasSet.add (aliases[i]);
     return Collections.unmodifiableSet (aliasSet);
@@ -376,9 +377,9 @@ public abstract class Charset implements Comparable
       }
   }
 
-  public final int compareTo (Object ob)
+  public final int compareTo (Charset other)
   {
-    return canonicalName.compareToIgnoreCase (((Charset) ob).canonicalName);
+    return canonicalName.compareToIgnoreCase (other.canonicalName);
   }
 
   public final int hashCode ()