6714245: [Col] Collator - Faster Comparison for identical strings.

Reviewed-by: rriggs, naoto
This commit is contained in:
Justin Lu 2023-05-12 19:58:37 +00:00
parent a284920b34
commit 4441a2306f

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -358,6 +358,10 @@ public class RuleBasedCollator extends Collator{
throw new NullPointerException();
}
if (source.equals(target)) {
return Collator.EQUAL;
}
// The basic algorithm here is that we use CollationElementIterators
// to step through both the source and target strings. We compare each
// collation element in the source string against the corresponding one