mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8305785: Avoid redundant HashMap.containsKey call in java.util.regex
Reviewed-by: stsypanov, jpai
This commit is contained in:
parent
8011ba74a2
commit
6b65e5754c
2 changed files with 10 additions and 7 deletions
|
@ -2712,14 +2712,15 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||
if (read() != '<')
|
||||
throw error("\\k is not followed by '<' for named capturing group");
|
||||
String name = groupname(read());
|
||||
if (!namedGroupsMap().containsKey(name))
|
||||
Integer number = namedGroupsMap().get(name);
|
||||
if (number == null)
|
||||
throw error("named capturing group <" + name + "> does not exist");
|
||||
if (create) {
|
||||
hasGroupRef = true;
|
||||
if (has(CASE_INSENSITIVE))
|
||||
root = new CIBackRef(namedGroupsMap().get(name), has(UNICODE_CASE));
|
||||
root = new CIBackRef(number, has(UNICODE_CASE));
|
||||
else
|
||||
root = new BackRef(namedGroupsMap().get(name));
|
||||
root = new BackRef(number);
|
||||
}
|
||||
return -1;
|
||||
case 'l':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue