Feb 24, 2017 · 1 min read
The idea of “Non-Strings as keys” is also known as a Dictionary. The question is often asked: “Why is storing values as keys so cool?”
With a Dictionary, for example, we can store extra information to be associated with an instance or object WITHOUT modifying that instance. This means we can runtime ‘decorate’ the instance with extra properties…. without actual modifying the original instance.
Consider instances of Class Employee. We want to cross-reference a Rating object (at runtime) with each employee instance. Using a Dictionary (aka Map) this is easy.
I love this feature!
