Builds Maps.
Example
// builds a sorted, weak-value Map.
var myMap :Map = Maps.newBuilder(String)
.makeSorted()
.makeWeakValues()
.build();
public function MapBuilder(keyClazz:Class)Parameters
public function build():Map
Build the Map!
Returns
public function makeExpiring(ttl:int, expireHandler:Function = null):MapBuilder
Make the Map auto-expire elements.
Parameters
| ttl:int — the time to live
|
| |
| expireHandler:Function (default = null) — function to receive notifications when a mapping expires.
signature: function (key :Object, value :Object) :void;
|
Returns
public function makeImmutable():MapBuilder
Make the Map immutable.
Returns
public function makeLR(maxSize:int, accessOrder:Boolean = true):MapBuilder
Make the Map a cache, disposing of the least-recently-accessed (or least-recently-inserted)
mappings whenever size exceeds maxSize. Iterating over this map (via keys(), values(),
or forEach()) will visit the oldest mappings first.
Parameters
| maxSize:int |
| |
| accessOrder:Boolean (default = true) |
Returns
public function makeSorted(comp:Function = null):MapBuilder
Make the Map sorted. If no Comparator is specified, then one is
picked based on the keyClazz, falling back to Comparators.compareUnknowns.
Parameters
| comp:Function (default = null) |
Returns
public function makeWeakValues():MapBuilder
Make the Map have weakly-held values.
Returns
public function put(key:Object, value:Object):MapBuilder
Put a mapping into the Map, once built.
If put is called more than once with the same key, the last value put will be
contained in the Map.
Parameters
Returns
public function setDefaultValue(value:*):MapBuilder
Make the Map have a default value other than undefined.
Parameters
Returns
Copyright © 2007-2009 Three Rings Design, Inc.