views:

47

answers:

1

This is in Squeak/Pharo. If I want to have a mapping between Character objects like $a and $b to other kinds of objects, and want to look up those other objects based on the Character, what is the best class to use? Dictionary is an obvious choice, but seems wasteful to be hashing character objects which are basically already numbers. I guess what I want is a kind of array where the character value (number) is used as an index/offset, but I am not sure if this is possible with Unicode.

+2  A: 

At least the hashing's cheap: Character hash just says "^value".

Frank Shearar
I found a CharacterSet class, but that just seems suited for sending includes: tests and not mappings. I guess a Dictionary is the way to go.
nullPointerException