Does a Java HashMap
save duplicate values as unique or does it save them individually?
Let's imagine I have the following key-value pairs value:
A -> "a very long string...."
B -> "another very long string...."
C -> "the same very long string from A key.... (but not same string instance)"
Will it be saved as 3 keys and 3 values, or as 3 keys and 2 values (as value for A
is exactly the same as value for C
)
My concern is about sizing as the values I am going to save are quite big and make no sense duplicate them.