Closed TatianaBuica closed 3 years ago
@TatianaBuica did you find a bug ? do you have a reproducer ?
When I am trying to make the following insert into a MultiMap
, keys doorsUser and encryptionAlgorithm are always fighting for index 4.
MultiMap form = MultiMap.caseInsensitiveMultiMap();
form.add("doorsUser", "aa");
form.add("encryptionAlgorithm", "");
The fact that the index is calculated as I mentioned above, it is a bit confusing and I am not sure if this is a bug.
is there a bug ? i.e is data overwritten when you use the MultiMap
?
it's expected to have collision inside the implementation, that's how hash tables work https://en.wikipedia.org/wiki/Hash_table#Collision_resolution
I ran the code you provided:
public static void main(String[] args) {
MultiMap form = MultiMap.caseInsensitiveMultiMap();
form.add("doorsUser", "aa");
form.add("encryptionAlgorithm", "");
for (Object o : form) {
System.out.println("o = " + o);
}
System.out.println("doorsUser=" + form.get("doorsUser"));
System.out.println("encryptionAlgorithm=" + form.get("encryptionAlgorithm"));
}
and I got
o = doorsUser=aa
o = encryptionAlgorithm=
doorsUser=aa
encryptionAlgorithm=
The fact that the index is calculated like this (in
CaseInsensitiveHeaders
), it overrides my entries.It is intended to not allow you to have more than 17 entries and override them? If so, could you please let me know what can I use instead?