The collection packages

The ActionScript Foundry now includes a collections package. Inspired by the Java collections framework, we tried to provide a lightweight package for representing and manipulating collections in ActionScript / Flex applications and libraries :

  • Reduces programming effort by providing useful data structures.
  • Increase software reuse by providing a standard interface for collections.
  • Reduces the effort required to implement APIs by eliminating the need to produce ad hoc collections APIs.

The collections package is intended to be simple to use and extend, so it contains less classes than the Java Collections framework.


This collections framework assumes the use of IBasicObject as the basic type for values (and keys, when applicable).

The collections framework, included in the commons library, is composed of two packages :

  • Collection : the collection type hierarchy. A collection is a group of objects (the elements).
  • Map : the map type hierarchy. A map is an object that maps keys to values.


The collection package contains several collection types, all of them inheriting the ICollection interface.

The following list describes the core collection interfaces:

  • ICollection : the root of the classes hierarchy.
  • ISet : the ISet interface describes collection that cannot contain duplicate elements.
  • ISortedSet : the ISortedSet extends ISet and allows sorting of elements using the IComparator interface.
  • IList : an ordered collection, that can contain duplicate elements.
ActionScript - Collection package

ActionScript - Collection package


The map package contains several map types, all of them inheriting the IMap interface.

The following list describes the core map interfaces:

  • IMap : the root of the classes hierarchy.
  • ISortedMap : the ISortedMap interface extends IMap and allows sorting of keys using the IComparator interface.
ActionScript - Map package

ActionScript - Map package

You can notice the DictionaryTable class, a simple IMap implementation, using String as keys (just like the Object class, but providing all the methods of the IMap interface). It is extensively used into the ActionScript Foundry, particularly when working with forms data (see “Using the SmartForm” for more).

More about ActionScript collections and maps

Please check the ActionScript API documentation to see more about collections and maps.

Previous Step

Next Step

Friday, November 21st, 2008 1 Comment by Sylvain Didier