The LazyCollection class implements a collection
whose items require conversion from a source data format
to some other data type. For example, converting
SOAP or JSON to ActionScript data classes.
The Flex SDK used to convert all of the data items
when the source data arrived, which, for very large data sets
or complex data classes, could lock up the user interface.
The lazy collection converts items as they are fetched from
the collection, resulting in significant performance savings
in many cases. Note that, if you need to compute a summary of
data in the collection when the source data arrives, the
computation can still lock up the user interface as you will
have to visit and convert every data item. Of course, it is
possible to compute that summary in a worker or pseudo-thread.
The LazyCollection class is designed to be a bead that attaches
to a data retrieval strand that dispatches an Event.COMPLETE and
has a "data" property that gets passed to the input parser.
This LazyCollection does not support adding/removing items from
the collection or sending data back to the source. Subclasses
have that additional functionality.
A lazy collection uses an IInputParser to convert the source data items
into an array of data items. This is required in order to determine
the length of the collection. This conversion happens as the source
data arrives so it needs to be fast to avoid locking up the UI.
Implementation public function get inputParser():IInputParser public function set inputParser(value:IInputParser):void
A lazy collection uses an IItemConverter to convert the source data items
into the desired data type. The converter is only called as items
are fetched from the collection.
Implementation public function get itemConverter():IItemConverter public function set itemConverter(value:IItemConverter):void