Commit 6817009
committed
[PATCH] Avoid redundant HashMap.containsKey call in java.util.regex{Matcher, Pattern}
Pattern.namedGroupsMap and Matcher.namedGroups contains only non-null values.
It means instead of separate containsKey+get calls, we can use single HashMap.get call and then compare result with null.
Result code is a bit simpler and faster.1 parent 314db55 commit 6817009
File tree
2 files changed
+7
-5
lines changed2 files changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1819 | 1819 | | |
1820 | 1820 | | |
1821 | 1821 | | |
1822 | | - | |
| 1822 | + | |
| 1823 | + | |
1823 | 1824 | | |
1824 | | - | |
| 1825 | + | |
1825 | 1826 | | |
1826 | 1827 | | |
1827 | 1828 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2612 | 2612 | | |
2613 | 2613 | | |
2614 | 2614 | | |
2615 | | - | |
| 2615 | + | |
| 2616 | + | |
2616 | 2617 | | |
2617 | 2618 | | |
2618 | 2619 | | |
2619 | 2620 | | |
2620 | | - | |
| 2621 | + | |
2621 | 2622 | | |
2622 | | - | |
| 2623 | + | |
2623 | 2624 | | |
2624 | 2625 | | |
2625 | 2626 | | |
| |||
0 commit comments