mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8151384: Improve String.CASE_INSENSITIVE_ORDER and remove sun.misc.ASCIICaseInsensitiveComparator
Reviewed-by: shade, sherman
This commit is contained in:
parent
34313c01e3
commit
bd69ca08d2
7 changed files with 99 additions and 132 deletions
|
@ -34,9 +34,9 @@ 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
|
||||
|
@ -501,7 +501,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
|
|||
*/
|
||||
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;
|
||||
|
@ -513,7 +513,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
|
|||
*/
|
||||
public int hashCode() {
|
||||
if (hashCode == -1) {
|
||||
hashCode = ASCIICaseInsensitiveComparator.lowerCaseHashCode(name);
|
||||
hashCode = name.toLowerCase(Locale.ROOT).hashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue