src/java.base/share/classes/java/util/jar/Attributes.java

Print this page
rev 13834 : 8151384: Examine sun.misc.ASCIICaseInsensitiveComparator
Reviewed-by: shade, sherman

@@ -32,13 +32,13 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.Collection;
 import java.util.AbstractSet;
 import java.util.Iterator;
+import java.util.Locale;
 import sun.util.logging.PlatformLogger;
 import java.util.Comparator;
-import sun.misc.ASCIICaseInsensitiveComparator;
 
 /**
  * The Attributes class maps Manifest attribute names to associated string
  * values. Valid attribute names are case-insensitive, are restricted to
  * the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70

@@ -499,11 +499,11 @@
          * @return true if this attribute name is equal to the
          *         specified attribute object
          */
         public boolean equals(Object o) {
             if (o instanceof Name) {
-                Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
+                Comparator<String> c = String.CASE_INSENSITIVE_ORDER;
                 return c.compare(name, ((Name)o).name) == 0;
             } else {
                 return false;
             }
         }

@@ -511,11 +511,11 @@
         /**
          * Computes the hash value for this attribute name.
          */
         public int hashCode() {
             if (hashCode == -1) {
-                hashCode = ASCIICaseInsensitiveComparator.lowerCaseHashCode(name);
+                hashCode = name.toLowerCase(Locale.ROOT).hashCode();
             }
             return hashCode;
         }
 
         /**