Last Version: 1.0
Available Collection: List, Map, Stack, Queue, MultiMap, TreeMap, TreeSet, BiMap
Scheduled Collection: None
Author: Simon Chang
Email: [email protected]
Represents a list of objects that can be accessed by index.
- size()
- clear()
- set(value) -- value: not undefined
- get(index)
- setRange(values) -- values: Array or List
- insert(index, value)
- insertRange(index, values) -- values: Array or List
- contains(value)
- indexOf(value) -- first index
- lastIndexOf(value)
- indicesOf(value)
- empty()
- removeAt(index)
- removeRange(from, to) -- from <= index < to
- remove(value) -- remove first element
- removeLast(value)
- removeAll(value)
- reverse()
- sub(from, to) -- from <= index < to
- toArray()
- each(fn) -- fn: function(index, value)
- filter(fn) -- fn: function(index, value) { return Boolean }
- toString()
var l1 = new List();
var l2 = new List([1, 2, 3]);
var l3 = new List(new List([1, 2, 3]));
Represents a collection of keys and values.
- size()
- clear()
- set(key, value) -- key: not undefined, value: not undefined
- get(key) -- get value by key
- getByValue(value) -- get keys by value
- containsKey(key)
- containsValue(value)
- remove(key) -- remove by key
- removeByValue(value)
- empty()
- each(fn) -- fn: function(key, value)
- filter(fn) -- fn: function(key, value) { return Boolean }
- keys()
- values()
- toString()
var m = new Map();
Represents a variable size last-in-first-out (LIFO) collection of objects.
- size()
- clear()
- push(value) -- value: not undefined
- pop()
- pushRange(values) -- values: Array or List
- peek()
- contains(value)
- empty()
- toArray()
- each(fn) -- fn: function(value)
the Stack will be empty if 'each' method completely executed
- toString()
var s1 = new Stack();
var s2 = new Stack([1, 2, 3]);
var s3 = new Stack(new List([1, 2, 3]));
Represents a variable size first-in, first-out (FIFO) collection of objects.
- size()
- clear()
- offer(value) -- value: not undefined
- poll()
- offerRange(values) -- values: Array or List
- peek()
- contains(value)
- empty()
- toArray()
- each(fn) -- fn: function(value)
the Queue will be empty if 'each' method completely executed
- toString()
var q1 = new Queue();
var q2 = new Queue([1, 2, 3]);
var q3 = new Queue(new List([1, 2, 3]));
Represents a collection similar to a Map, but which may associate multiple values with a single key.
- size()
- clear()
- set(key, value) -- key: not undefined, value: not undefined
- get(key) -- get value by key
- getByValue(value) -- get keys by value
- getNumberOfValues(key)
- containsKey(key)
- containsValue(value)
- remove(key) -- remove pair by key
- removeByValue(value)
- removeByContainsValue(value)
- removeValue(value) -- remove value not pair
- empty()
- each(fn) -- fn: function(key, value)
- filter(fn) -- fn: function(key, value) { return Boolean }
- keys()
- values()
- toString()
var mm = new MultiMap();
Represents a map is sorted according to the natural ordering of its keys.
- size()
- clear()
- set(key, value) -- key: not undefined, value: not undefined
- get(key) -- get value by key
- getByValue(value) -- get keys by value
- containsKey(key)
- containsValue(value)
- remove(key) -- remove by key
- removeByValue(value)
- empty()
- each(fn) -- fn: function(key, value)
- filter(fn) -- fn: function(key, value) { return Boolean }
- keys()
- values()
- toString()
var tm = new TreeMap();
Represents a set is sorted according to the natural ordering of its elements.
- size()
- clear()
- set(value) -- value: not undefined
- setRange(values) -- values: Array or List
- contains(value)
- empty()
- remove(value)
- toArray()
- each(fn) -- fn: function(value)
- filter(fn) -- fn: function(value) { return Boolean }
- toString()
var ts1 = new TreeSet();
var ts2 = new TreeSet([1, 2, 3]);
var ts3 = new TreeSet(new List([1, 2, 3]));
Represents a map that preserves the uniqueness of its values as well as that of its keys. BiMap is abbreviation of "Bidirectional Map".
- size()
- clear()
- set(key, value) -- key: not undefined, value: not undefined
- get(key) -- get value by key
- getByValue(value) -- get key by value
- containsKey(key)
- containsValue(value)
- remove(key) -- remove by key
- removeByValue(value)
- empty()
- each(fn) -- fn: function(key, value)
- filter(fn) -- fn: function(key, value) { return Boolean }
- keys()
- values()
- toString()
var bm = new BiMap();
Framework: QUnit
Version: 1.11.0
Tool: Closure Compiler
Version: 20121212
GNU GENERAL PUBLIC LICENSE Version 2