diff options
author | Tom Tromey <tromey@redhat.com> | 2007-02-01 20:34:08 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-02-01 20:34:08 +0000 |
commit | 0a32f469ac256a842ac1f721c37dab7ad2cf5e21 (patch) | |
tree | 045d28c226132bbb212ffd4956739e8e6fde799b /libjava/java/nio | |
parent | 62e5bf5d4203458b41813a79213b3f513a4ca98c (diff) | |
download | gcc-0a32f469ac256a842ac1f721c37dab7ad2cf5e21.zip gcc-0a32f469ac256a842ac1f721c37dab7ad2cf5e21.tar.gz gcc-0a32f469ac256a842ac1f721c37dab7ad2cf5e21.tar.bz2 |
Calendar.java: Implement Comparable<Calendar>.
* java/util/Calendar.java: Implement Comparable<Calendar>. Update
comments.
(clear): Call complete.
(setTimeZone): Call computeTime, computeFields.
(compareTo): New method.
* java/nio/charset/Charset.java: Implement Comparable<Charset>.
(availableCharsets): Genericized.
(aliases): Likewise.
(compareTo): Changed argument type.
* java/lang/ClassLoader.java (loadClass): Genericized.
(findClass): Likewise.
(defineClass): Likewise.
(resolveClass): Likewise.
(findSystemClass): Likewise.
(setSigners): Likewise.
(findLoadedClass): Likewise.
(getResources): Likewise.
(findResources): Likewise.
(getSystemResources): Likewise.
(checkInitialized): New method.
* java/lang/Class.java (getCanonicalName): New method.
From-SVN: r121471
Diffstat (limited to 'libjava/java/nio')
-rw-r--r-- | libjava/java/nio/charset/Charset.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java index 48093bc9d..04b3819 100644 --- a/libjava/java/nio/charset/Charset.java +++ b/libjava/java/nio/charset/Charset.java @@ -1,5 +1,5 @@ /* Charset.java -- - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -61,14 +61,15 @@ import java.util.TreeMap; /** * @author Jesse Rosenstock * @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; /** - * Charset providers. + * Extra Charset providers. */ private static CharsetProvider[] providers; @@ -174,7 +175,7 @@ public abstract class Charset implements Comparable * Returns the Charset instance for the charset of the given name. * * @param charsetName - * @return + * @return the Charset instance for the indicated charset * @throws UnsupportedCharsetException if this VM does not support * the charset of the given name. * @throws IllegalCharsetNameException if the given charset name is @@ -221,19 +222,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); @@ -295,14 +297,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); @@ -387,9 +389,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 () |