(minor) Clean up StringPool

This commit is contained in:
Viktor Lofgren 2023-06-12 17:42:28 +02:00 committed by Viktor
parent e4372289a5
commit d1a004bea6

View File

@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;
public class StringPool {
@ -29,10 +30,7 @@ public class StringPool {
final String ret = words.putIfAbsent(str, str);
ages.put(ret, idx++);
if (null == ret)
return str;
return ret;
return Objects.requireNonNullElse(ret, str);
}
public String[] internalize(String[] str) {