Builds Sets.
Example
// builds a sorted Set that keeps the 10 most-recently inserted entries.
var mySet :Set = Sets.newBuilder(String)
.makeSorted()
.makeLRI(10)
.build();
public function SetBuilder(valueClazz:Class)
Parameters
public function add(value:Object):SetBuilder
Add a value to the Set, once built.
Parameters
Returns
public function addAll(values:Array):SetBuilder
Adds all objects in the values Array to the Set, once built.
Parameters
Returns
public function build():Set
Build the Set!
Returns
public function makeExpiring(ttl:int, expireHandler:Function = null):SetBuilder
Make the Set auto-expire elements.
Parameters
| ttl:int — the time to live
|
|
| expireHandler:Function (default = null ) — function to receieve notifications when an element expires.
signature: function (element :Object) :void;
|
Returns
public function makeImmutable():SetBuilder
Make the Set immutable.
Returns
public function makeLR(maxSize:int, accessOrder:Boolean = true):SetBuilder
Make the Set a cache, disposing of the least-recently-accessed (or just inserted) value
whenever size exceeds maxSize. Iterating over this Set (via forEach() or toArray()) will
see the oldest entries first.
Parameters
| maxSize:int |
|
| accessOrder:Boolean (default = true )
|
Returns
public function makeSorted(comp:Function = null):SetBuilder
Make the Map sorted. If no Comparator is specified, then one is picked
based on the valueClazz, falling back to Comparators.compareUnknowns.
Parameters
| comp:Function (default = null )
|
Returns
Copyright © 2007-2009 Three Rings Design, Inc.