Skip to content

Commit 9ab5fbb

Browse files
authored
Cache hashCode of PropertyName (#1281)
Given we are adding quite a lot of elements, there are a lot of chances the maps will have to be resized several times.
1 parent 2bcff37 commit 9ab5fbb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

implementation/src/main/java/io/smallrye/config/PropertyName.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
public class PropertyName {
66
private final String name;
7+
private final int hashCode;
78

89
public PropertyName(final String name) {
910
this.name = name;
11+
this.hashCode = buildHashCode();
1012
}
1113

1214
public String getName() {
@@ -97,6 +99,10 @@ private static boolean equalsInternal(final String name, final String other) {
9799

98100
@Override
99101
public int hashCode() {
102+
return hashCode;
103+
}
104+
105+
private int buildHashCode() {
100106
int h = 0;
101107
int length = name.length();
102108
boolean quotesOpen = false;

0 commit comments

Comments
 (0)