I need to map dictionaries between characters and other objects. Which class would be better?

This is at Squeak / Pharo. If I want to have a mapping between character objects, such as $ a and $ b, for other objects, and you want to find these other objects based on a character, what is the best class to use? The dictionary is an obvious choice, but it seems wasteful to have hash character objects, which are basically numbers already. I suppose what I want is an array type where the character value (number) is used as an index / offset, but I'm not sure if this is possible in Unicode.

+3
source share
1 answer

At least hashing is cheap: the hash of the hash just says " ^value".

+2
source

Source: https://habr.com/ru/post/1748630/


All Articles