Pretty banner! :)

Type Safe Dictionary with Default Support

Dictionary

The following KeyValueMap class is a functional replacement for ActionScript 3.0’s built in dictionary. KeyValueMap provides you with some additional functionality that is not available in the built-in class.

The first is that KeyValueMap has default support. The primary benefit of this is to simplify the code needed when using a traditional dictionary. You can safely “get” a value, whether or not it exists.

The second major benefit is that it is type safe. There is no chance of accidentally casting a Boolean to a String.

The third benefit is the integration functionality. You can combine two KeyValueMaps by using the “integrate” and “getDictionary” functionality exposed by KeyValueMap.

Here’s the class. Have fun.

Post Metadata

Date
September 12th, 2008

Author
urbansquall

Category

Tags


Leave a Reply