rename put method to help IDEs find references

This commit is contained in:
2021-10-16 18:33:20 +02:00
parent 393de7ffec
commit d7cd4a94a5
2 changed files with 9 additions and 8 deletions

View File

@@ -165,7 +165,7 @@ public class UniqueStringIntegerPairs {
intToString.set(value, string);
}
void put(final String string, final int integer) {
void putStringAndInteger(final String string, final int integer) {
if (stringToInt.containsKey(string) || (intToString.size() > integer && intToString.get(integer) != null)) {
throw new IllegalArgumentException("Unique key constraint violation for (" + string + ", " + integer + ")");
@@ -197,7 +197,7 @@ public class UniqueStringIntegerPairs {
synchronized (stringToInt) {
if (!stringToInt.containsKey(string)) {
final Integer second = mappingFunction.apply(string);
put(string, second);
putStringAndInteger(string, second);
}
}
}
@@ -231,7 +231,8 @@ public class UniqueStringIntegerPairs {
}
final Integer integer = intToString.size();
put(normalizedString, integer); // adds the normalized String to stringToInt and bytesToInt
putStringAndInteger(normalizedString, integer); // adds the normalized String to stringToInt and
// bytesToInt
bytesToInt.put(byteArray, integer); // also add the original String to bytesToInt, because it is
// used as cache
}