donut_small AbstractBinaryTree<E>
- Abstract Implementation of binary tree. (Note: This class cannot be used to initialize objects.)
hdr_strong
Implements:
BinaryTree
new AbstractBinaryTree<E>(label)
play_circle_outline "AbstractBinaryTree" Methods
_.delete(item)
- Delete an item from the binary tree.
hdr_strong
Implementation of:
BinaryTree.delete
_.height(node)
- Returns the height of this binary tree.
@example
bt.height();// returns a number.
hdr_strong
Implementation of:
BinaryTree.height
_.inorder(node)
- Returns the list of items obtained after inorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.inorder();
hdr_strong
Implementation of:
BinaryTree.inorder
_.insert(item)
- Insert a new item to the binary tree.
hdr_strong
Implementation of:
BinaryTree.insert
_.postorder(node)
- Returns the list of items obtained after postorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.postorder();
hdr_strong
Implementation of:
BinaryTree.postorder
_.preorder(node)
- Returns the list of items obtained after preorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.preorder();
hdr_strong
Implementation of:
BinaryTree.preorder
donut_small AbstractCollection<T>
- An abstract implementation of Collection interface
hdr_strong
Extends:
AbstractIterable
new AbstractCollection<T>(...items)
play_circle_outline "AbstractCollection" Methods
_.add(item)
- Add an item to this collection
@example
//collection contains [1,2,3,4]
collection.add(5);
//now collection contains [1,2,3,4,5]
hdr_strong
Implementation of:
Collection.add
_.addAll(items)
- Add all items of an array to this collection
@example
//collection contains [1,2,3,4,5]
collection.addAll([6,7]);
//now collection contains [1,2,3,4,5,6,7]
hdr_strong
Implementation of:
Collection.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Implementation of:
Collection.clear
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Implementation of:
Collection.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Implementation of:
Collection.containsAll
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Implementation of:
Collection.equals
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Implementation of:
Collection.forEach
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Implementation of:
Collection.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Implementation of:
Collection.iterator
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Implementation of:
Collection.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Implementation of:
Collection.removeAll
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Implementation of:
Collection.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Implementation of:
Collection.retainAll
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Implementation of:
Collection.size
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Implementation of:
Collection.toArray
donut_small AbstractGraph<E>
- Abstract implementation of graph interface
hdr_strong
Implements:
Graph
hdr_weak
Extended By:
DiGraph
new AbstractGraph<E>()
play_circle_outline "AbstractGraph" Methods
_.add(label)
- Add a new vertex with the specified label to this graph.
@example
//g:Graph<number>
g.add(25);
hdr_strong
Implementation of:
Graph.add
_.addAll(labels)
- Add new vertices with the labels present in the specified array.
@example
//g:Graph<number>
g.addAll([25,22,11,43]);
hdr_strong
Implementation of:
Graph.addAll
_.addEdge(edge)
- Add the specified edge to the graph. The start and end vertices are added automatically to the graph if not present.
@example
//g:Graph<number>, e:Edge<number>
g.addEdge(e);
hdr_strong
Implementation of:
Graph.addEdge
_.addVertex(vertex)
- Add the specified vertex to the graph.
@example
//g:Graph<number>, v:Vertex<number>
g.addVertex(v);
hdr_strong
Implementation of:
Graph.addVertex
_.addVertices(vertices)
- Add all vertices in the specified array to the graph.
@example
//g:Graph<number>, a,b,c,d:Vertex<number>
g.addVertices([a,b,c,d]);
hdr_strong
Implementation of:
Graph.addVertices
_.adjacentEdges(vertex)
- Returns the set of edges starting from specified vertex.
@example
//g:Graph<number>, v:Vertex<number>
g.adjacentEdges(v);
hdr_strong
Implementation of:
Graph.adjacentEdges
_.adjacentVertices(vertex)
- Returns the set of vertices adjacent to the specified vertex.
@example
//g:Graph<number>, v:Vertex<number>
g.adjacentVertices(v);
hdr_strong
Implementation of:
Graph.adjacentVertices
_.createEdge(startLabel,endLabel)
- Create vertices from the given labels and an edge connecting them and add it to the graph.
@example
//g:Graph<number>
g.createEdge(25,26);
hdr_strong
Implementation of:
Graph.createEdge
_.edgeSet()
- Returns the set of edges present in the graph.
@example
//g:Graph<number>
g.edgeSet();
hdr_strong
Implementation of:
Graph.edgeSet
_.remove(label)
- Remove a single vertex with the specified label from the graph.
@example
//g:Graph<number>
g.remove(25);
hdr_strong
Implementation of:
Graph.remove
_.removeEdge(edge)
- Remove the specified edge from the graph.
@example
//g:Graph<number>, e:Edge<number>
g.removeEdge(e);
hdr_strong
Implementation of:
Graph.removeEdge
_.removeVertex(vertex)
- Remove the specified vertex from the graph.
@example
//g:Graph<number>, v:Vertex<number>
g.removeVertex(v);
hdr_strong
Implementation of:
Graph.removeVertex
_.vertexSet()
- Returns the set of vertices present in the graph.(a copy of the set is returned).
@example
//g:Graph<number>
g.vertexSet();
hdr_strong
Implementation of:
Graph.vertexSet
donut_small AbstractImmutableCollection<E>
- Abstract Implementation of ImmutableCollection Interface
hdr_strong
Implements:
ImmutableCollection
hdr_weak
Extended By:
Tuple
new AbstractImmutableCollection<E>(...items)
play_circle_outline "AbstractImmutableCollection" Methods
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Implementation of:
ImmutableCollection.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Implementation of:
ImmutableCollection.containsAll
_.size()
- Returns the size of the collection
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Implementation of:
ImmutableCollection.size
donut_small AbstractIterable<E>
hdr_strong
Implements:
Iterable
hdr_weak
Extended By:
AbstractCollection
donut_small AbstractList<E>
- An abstract implementation of List interface
hdr_strong
Extends:
AbstractCollection
new AbstractList<E>(...args)
play_circle_outline "AbstractList" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
List.__@iterator
_.add(item)
- Appends the specified element to the end of this list
_.add(item,index)
- Inserts the specified element at the specified position in this list
@example
//list contains [1,2,3]
list.add(4); //[1,2,3,4]
list.add(2.5,2); //[1,2,2.5,3,4]
hdr_strong
Implementation of:
List.add
_.addAll(items)
- Appends all of the elements in the specified array to the end of this list
_.addAll(items,index)
- Inserts all of the elements in the specified array into this list at the specified position.
@example
//list contains [1,2,3]
list.addAll([4,5]); //[1,2,3,4,5]
list.addAll([2.1,2.2,2.3], 2); //[1,2,2.1,2.2,2.3,3,4]
hdr_strong
Implementation of:
List.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
List.clear
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
List.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
List.containsAll
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
List.equals
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
List.forEach
_.get(index)
- Read an item from the list
@example
//list contains [1,2,3]
console.log(list.get(2));
//Output: 3
hdr_strong
Implementation of:
List.get
_.indexOf(item)
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
@example
//list contains [1,2,3,2,4]
console.log(list.indexOf(2));
//Output: 1
hdr_strong
Implementation of:
List.indexOf
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
List.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
List.iterator
_.lastIndexOf(item)
- Returns the index of last occurrence of the element.
//list contains [1,2,3,2,4]
console.log(list.lastIndexOf(2));
//Output: 3
hdr_strong
Implementation of:
List.lastIndexOf
_.median()
- Returns the median of this list. If the list is empty returns undefined.
In case of two medians the later one is preferred.
@example
//list contains [1, 2, 3, 4]
list.median(); //returns 3
hdr_strong
Implementation of:
List.median
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
List.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
List.removeAll
_.removeAt(index)
- Removes the element at the specified position in this list.
@example
//list contains [1,2,3]
console.log(list.removeAt(1)); //[1,3]
//Output: 2
hdr_strong
Implementation of:
List.removeAt
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
List.removeIf
_.removeRange(fromIndex,toIndex)
- Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.
@example
//list contains [1,2,3,4,5,6]
console.log(list.removeRange(1,4)); //[1,5,6]
//Output: [2,3,4]
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
List.retainAll
_.reverse()
- Reverse the list.
@example
//list contains [1,2,3,4,5]
list.reverse() //now list contains [5,4,3,2,1]
hdr_strong
Implementation of:
List.reverse
_.set(index,item)
- Replaces the element at the specified position in this list with the specified element
@example
//list contains [1,2,3]
console.log(list.set(1,2.5)); //[1,2.5,3]
//Output: 2
hdr_strong
Implementation of:
List.set
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
List.size
_.sort(compareFn)
- Sorts this list according to the compareFn.
compareFn is a function which should return a number value (-ve, zero, or +ve).
x is considered smaller than y if the compareFn(x,y) is negetive
@example
//list contains [1,8,6,2,7,3,9,11]
list.sort(function(x,y) {
return x-y;
}); // [1, 2, 3, 6, 7, 8, 9, 11]
hdr_strong
Implementation of:
List.sort
_.subList(fromIndex,toIndex)
- Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
@example
//list contains [1,8,6,2,7,3,9,11]
list.subList(2,7); // returns a list containing [6, 2, 7, 3, 9]
hdr_strong
Implementation of:
List.subList
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
List.toArray
donut_small AbstractMap<K,V>
hdr_strong
Implements:
Map
new AbstractMap<K,V>(...items)
play_circle_outline "AbstractMap" Methods
_.clear()
- Removes all of the mappings from this map.
@example
//map: [{"1":1},{"2":2},{"3":3}]
map.clear();
//now : []
hdr_strong
Implementation of:
Map.clear
_.compute(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to 12
map.compute(k1, (key,value,map)=>(value+11)); //returns 12
//now the value changes to 12+11 -> 23
hdr_strong
Implementation of:
Map.compute
_.computeIfAbsent(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to 12
map.computeIfAbsent(k1, (key,value,map)=>(23)); //returns 12
//value does not change
hdr_strong
Implementation of:
Map.computeIfAbsent
_.computeIfPresent(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to null
map.computeIfAbsent(k1, (key,value,map)=>(value+11)); //returns null
//value does not change
hdr_strong
Implementation of:
Map.computeIfPresent
_.containsKey(key)
- Returns true if this map contains a mapping for the specified key.
@example
//map : [{k1:1},{k2:2}]
map.conainsKey(k1); //returns true
map.containsKey(k5); //returns false
hdr_strong
Implementation of:
Map.containsKey
_.containsValue(value)
- Returns true if this map maps one or more keys to the specified value.
@example
//map : [{k1:1},{k2:2}]
map.conainsValue(1); //returns true
map.containsValue(5); //returns false
hdr_strong
Implementation of:
Map.containsValue
_.entrySet()
- Returns a Set view of the mappings contained in this map.
@example
//map : [{k1:1},{k2:2}]
map.entrySet(); //returns Set [{key:k1, value:1},{key:k2, value:2}]
hdr_strong
Implementation of:
Map.entrySet
_.equals(map)
- Compares the specified map with this map for equality.
@example
//map1 : [{k1:1},{k2:2},{k3:null}]
//map2 : [{k1:1},{k3:4}]
map1.equals(map2) //returns false
hdr_strong
Implementation of:
Map.equals
_.forEach(action)
- Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.forEach((key, value, map)=>{
console.log(key+"->"+value+",");
});
//Output: one->1,two->2,three->3
hdr_strong
Implementation of:
Map.forEach
_.get(key)
- Returns the value to which the specified key is mapped. undefined if there is no mapping.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.get(k1); //returns 1
map.get(k3); //returns null
map.get(k4); //returns undefined
hdr_strong
Implementation of:
Map.get
_.getOrDefault(key,defaultValue)
- Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key or if key is mapped to null.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.getOrDefault(k1,5); //returns 1
map.getOrDefault(k3,12); //returns 12
map.getOrDefault(k4,16); //returns 16
hdr_strong
Implementation of:
Map.getOrDefault
_.isEmpty()
- Returns true if this map contains no key-value mappings.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.isEmpty(); //false
//map : [{k1:null},{k2:null},{k3:null}]
map.isEmpty(); //false
//map : []
map.isEmpty(); //true
hdr_strong
Implementation of:
Map.isEmpty
_.isNull()
- Returns true if this map contains mappings to only null values or if the map is empty.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.isNull(); //false
//map : [{k1:null},{k2:null},{k3:null}]
map.isNull(); //true
//map : []
map.isNull(); //true
_.keySet()
- Returns a Set view of the keys contained in this map.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.keySet(); //["one","two","three"]
hdr_strong
Implementation of:
Map.keySet
_.put(key,value)
- Associates the specified value with the specified key in this map.Returns the old value associated with the key or undefined.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.put("one",22); //return 1
//now map : [{"one":22},{"two":2},{"three":3}]
map.put("four",4);//return undefined
//now map : [{"one":22},{"two":2},{"three":3},{"four":4}]
hdr_strong
Implementation of:
Map.put
_.putAll(map)
- Copies all of the mappings from the specified map to this map.
@example
//map1: [{k1:v1},{k2:v2},{k3:v3}], map2: [{k2:v4},{k4:v6},{k6:v8}]
map1.putAll(map2);
//now map1: [{k1:v1},{k2:v4},{k3:v3},{k4:v6},{k6:v8}]
hdr_strong
Implementation of:
Map.putAll
_.putIfAbsent(key,value)
- If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns undefined, else returns the current value.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.putIfAbsent("four",4); //return undefined (adds {"four":4} to the map)
map.putIfAbsent("one",23); //return 1 (map unchanged)
hdr_strong
Implementation of:
Map.putIfAbsent
_.remove(key)
- Removes the mapping for a key from this map if it is present.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.remove("one"); //return 1
//now map : [{"two":2},{"three":3}]
map.remove("four"); //return undefined (map unchanged)
hdr_strong
Implementation of:
Map.remove
_.removeIf(key,value)
- Removes the entry for the specified key only if it is currently mapped to the specified value.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.removeIf("one", 1); //return true
//now map : [{"two":2},{"three":3}]
map.removeIf("two",5); //return false (map unchanged)
map.removeIf("four",4); //return false
hdr_strong
Implementation of:
Map.removeIf
_.replace(oldValue,newValue)
- Replace all entries with specified value with the new value. Returns true if map was changed.
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.replace(5,2) //returns true;
//now map : [{k1:1},{k2:2},{k3:3},{k4:2},{k5:1}]
hdr_strong
Implementation of:
Map.replace
_.replaceAll(remappingFn)
- Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.replaceAll((k,v,m)=>(v*2)); //replace with its double
//map : [{k1:2},{k2:10},{k3:6},{k4:10},{k5:2}]
hdr_strong
Implementation of:
Map.replaceAll
_.size()
- Returns the number of key-value mappings in this map.(key->null mappings are counted)
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.size(); //return 5
hdr_strong
Implementation of:
Map.size
_.values()
- Returns a List view of the values contained in this map.
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.values(); //return list : [1,5,3,5,1]
hdr_strong
Implementation of:
Map.values
donut_small AbstractQueue<E>
- Abstract implementation of Queue interface
hdr_strong
Extends:
AbstractCollection
hdr_weak
Extended By:
PriorityQueue
new AbstractQueue<E>(...items)
play_circle_outline "AbstractQueue" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
Queue.__@iterator
_.add(item)
- Add an item to this collection
@example
//collection contains [1,2,3,4]
collection.add(5);
//now collection contains [1,2,3,4,5]
hdr_strong
Inherited from:
AbstractCollection.add
hdr_strong
Implementation of:
Queue.add
_.addAll(items)
- Add all items of an array to this collection
@example
//collection contains [1,2,3,4,5]
collection.addAll([6,7]);
//now collection contains [1,2,3,4,5,6,7]
hdr_strong
Inherited from:
AbstractCollection.addAll
hdr_strong
Implementation of:
Queue.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
Queue.clear
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
Queue.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
Queue.containsAll
_.element()
- Retrieves, but does not remove, the head of this queue
@example
//queue has elements [1,2,3,4]
console.log(queue.element());
//Output: 1
hdr_strong
Implementation of:
Queue.element
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
Queue.equals
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
Queue.forEach
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
Queue.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
Queue.iterator
_.poll()
- Retrieves and removes the head of this queue.
@example
//queue has elements [1,2,3,4]
console.log(queue.element());
//Output: 1 and queue now has elements [2,3,4]
hdr_strong
Implementation of:
Queue.poll
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
Queue.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
Queue.removeAll
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
Queue.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
Queue.retainAll
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
Queue.size
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
Queue.toArray
donut_small AbstractSet<E>
- Abstract implementation of Set interface.
hdr_strong
Extends:
AbstractCollection
hdr_weak
Extended By:
AbstractSortedSet
new AbstractSet<E>(...items)
play_circle_outline "AbstractSet" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
Set.__@iterator
_.add(item)
- Adds the specified element to this set if it is not already present
@example
//set contains [1,2,3,4,5]
set.add(6); //returns true and now set contains [1,2,3,4,5,6]
set.add(5); //returns false since 5 is already in the set.
hdr_strong
Implementation of:
Set.add
_.addAll(items)
- Adds all of the elements in the specified collection to this set if they're not already present
@example
//set contains [1,2,3,4,5]
set.add([4,5,6]); //returns true and now set contains [1,2,3,4,5,6]
set.add([5,6]); //returns false since 5 and 6 are already in the set.
hdr_strong
Implementation of:
Set.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
Set.clear
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
Set.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
Set.containsAll
_.difference(set)
- Returns a new set created by subtracting the specified set from this set.
@example
//set1 : [1,2,3,4,5] and set2 : [4,5,6,7]
set1.difference(set2); //returns a new set : [1,2,3]
hdr_strong
Implementation of:
Set.difference
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
Set.equals
_.exclusion(set)
- Returns a new set created by exclusion of this set and the set specified.
@example
//set1 : [1,2,3,4,5] and set2 : [4,5,6,7]
set1.difference(set2); //returns a new set : [1,2,3,6,7]
hdr_strong
Implementation of:
Set.exclusion
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
Set.forEach
_.intersection(set)
- Returns a new set created by intersection of this set and the set specified
@example
//set1 : [1,2,3,4,5] and set2 : [4,5,6,7]
set1.intersection(set2); //returns a new set : [4,5]
hdr_strong
Implementation of:
Set.intersection
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
Set.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
Set.iterator
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
Set.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
Set.removeAll
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
Set.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
Set.retainAll
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
Set.size
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
Set.toArray
_.union(set)
- Returns a new set created by union of this set and the set specified
@example
//set1 : [1,2,3,4] and set2 : [4,5,6,7]
set1.union(set2); //returns a new set : [1,2,3,4,5,6,7]
hdr_strong
Implementation of:
Set.union
donut_small AbstractSortedSet<E>
hdr_strong
Extends:
AbstractSet
new AbstractSortedSet<E>(compareFn,...items)
play_circle_outline "AbstractSortedSet" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
SortedSet.__@iterator
_.add(item)
- Adds the specified element to this set if it is not already present
@example
//set contains [1,3,6,8] //compareFn is ascending
set.add(4); //set: [1,3,4,6,8]
hdr_strong
Implementation of:
SortedSet.add
_.addAll(items)
- Inserts all items of an array into this set.
@example
//set containes [1,8,12] (compareFn designed for ascending order)
set.addAll([6,10,15]); //[1,6,8,10,12,15]
hdr_strong
Implementation of:
SortedSet.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
SortedSet.clear
_.comparator()
- Returns the compare function used to order the elements in this set.
@example
set.comparator(); //returns a function
hdr_strong
Implementation of:
SortedSet.comparator
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
SortedSet.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
SortedSet.containsAll
_.difference(set)
- Returns a new set created by subtracting the specified set from this set.
@example
//set1 : [1,2,3,4,5] and set2 : [4,5,6,7]
set1.difference(set2); //returns a new set : [1,2,3]
hdr_strong
Inherited from:
AbstractSet.difference
hdr_strong
Implementation of:
SortedSet.difference
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
SortedSet.equals
_.exclusion(set)
- Returns a new set created by exclusion of this set and the set specified.
@example
//set1 : [1,2,3,4,5] and set2 : [4,5,6,7]
set1.difference(set2); //returns a new set : [1,2,3,6,7]
hdr_strong
Inherited from:
AbstractSet.exclusion
hdr_strong
Implementation of:
SortedSet.exclusion
_.first()
- Returns the first (lowest) element currently in this set.
@example
//set contains [1,2,3,4]
set.first()
hdr_strong
Implementation of:
SortedSet.first
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
SortedSet.forEach
_.headSet(toItem)
- Returns a view of the portion of this set whose elements are strictly less than toElement.
@example
//set : [1,2,3,5,7,9]
set.headSet(6) //returns set : [1,2,3,5]
hdr_strong
Implementation of:
SortedSet.headSet
_.intersection(set)
- Returns a new set created by intersection of this set and the set specified
@example
//set1 : [1,2,3,4,5] and set2 : [4,5,6,7]
set1.intersection(set2); //returns a new set : [4,5]
hdr_strong
Inherited from:
AbstractSet.intersection
hdr_strong
Implementation of:
SortedSet.intersection
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
SortedSet.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
SortedSet.iterator
_.last()
- Returns the last (highest) element currently in this set.
@example
//set contains [1,2,3,4]
set.last();
hdr_strong
Implementation of:
SortedSet.last
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
SortedSet.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
SortedSet.removeAll
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
SortedSet.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
SortedSet.retainAll
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
SortedSet.size
_.subSet(fromItem,toItem)
- Returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive.
@example
//set contains [1,2,3,4,5,6,7,8,9,10]
set.subSet(4,9) //returns set : [4,5,6,7,8]
hdr_strong
Implementation of:
SortedSet.subSet
_.tailSet(fromItem)
- Returns a view of the portion of this set whose elements are greater than or equal to fromElement.
@example
//set : [1,2,3,5,7,9]
set.tailSet(4) //returns set : [5,7,9]
hdr_strong
Implementation of:
SortedSet.tailSet
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
SortedSet.toArray
_.union(set)
- Returns a new set created by union of this set and the set specified
@example
//set1 : [1,2,3,4] and set2 : [4,5,6,7]
set1.union(set2); //returns a new set : [1,2,3,4,5,6,7]
hdr_strong
Inherited from:
AbstractSet.union
hdr_strong
Implementation of:
SortedSet.union
donut_small AbstractTable<R,C,V>
hdr_strong
Implements:
Table
hdr_weak
Extended By:
EntryTable
new AbstractTable<R,C,V>()
play_circle_outline "AbstractTable" Methods
_.add(rowKey,row)
- Add a row to this table only if row curresponding to given key is absent.
@example
//t:Table<number,number,string>
var r = new ArrayMap<number,string>(5);
r.add(1,'01');
r.add(2,'02');
r.add(3,'03');
t.add(0, r);
/*
+-----+-----+-----+-----+
| X | 1 | 2 | 3 |
+-----+-----+-----+-----+
| 0 | 01 | 02 | 03 |
+-----+-----+-----+-----+
hdr_strong
Implementation of:
Table.add
_.delete(rowKey)
- Delete an entire row from this table.
@example
t.delete(0); //calling this function makes the table empty.
hdr_strong
Implementation of:
Table.delete
_.deleteIf(filterFn)
- Delete an entire row from this table based on filter function.
hdr_strong
Implementation of:
Table.deleteIf
_.drop(columnKey)
- Delete an entire column from this table.
@example
t.drop(2);
/*
+-----+-----+-----+
| X | 1 | 3 |
+-----+-----+-----+
| 0 | 01 | 03 |
+-----+-----+-----+
hdr_strong
Implementation of:
Table.drop
_.extract(columnKey)
- Read an entire column of this table.
@example
t.extract(2); //returns <Map>[{0:'02'}]
t.extract(5); //returns <Map>[{0: undefined}]
hdr_strong
Implementation of:
Table.extract
_.fetch(rowKey)
- Read an entire row of this table.
@example
t.fetch(0); //returns <Map>[{1:'01'},{2:'02'},{3:'03'}]
t.fetch(1); //returns undefined
hdr_strong
Implementation of:
Table.fetch
_.get(rowKey,columnKey)
- Read an entry from this table.
@example
t.get(0,3); //returns '03'
hdr_strong
Implementation of:
Table.get
_.project(columns)
- Return a subset of columns in this table.
hdr_strong
Implementation of:
Table.project
_.remove(rowKey,columnKey)
- Remove an entry from this table.
@example
t.remove(0,3); //returns '03' and removes it from the table
hdr_strong
Implementation of:
Table.remove
_.select(filterFn)
- Return a subset of rows in this table based on the filter function.
hdr_strong
Implementation of:
Table.select
_.set(rowKey,columnKey,value)
- Replaces the value at the specified position in this table with the specified value.
@example
t.set(0,2,'2'); //returns '02'
t.set(1,2,'12'); //returns undefined
/*
+-----+-----+-----+-----+
| X | 1 | 2 | 3 |
+-----+-----+-----+-----+
| 0 | 01 | 2 | 03 |
+-----+-----+-----+-----+
hdr_strong
Implementation of:
Table.set
donut_small ArrayList<E>
- Resizable-array implementation of the List interface.
hdr_strong
Extends:
AbstractList
hdr_weak
Extended By:
HistoryList
new ArrayList<E>()
new ArrayList<E>(initialCapacity)
new ArrayList<E>(initialCapacity,...items)
play_circle_outline "ArrayList" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
List.__@iterator
_.add(item)
- Appends the specified element to the end of this list
_.add(item,index)
- Inserts the specified element at the specified position in this list
@example
//list contains [1,2,3]
list.add(4); //[1,2,3,4]
list.add(2.5,2); //[1,2,2.5,3,4]
hdr_strong
Implementation of:
List.add
_.addAll(items)
- Appends all of the elements in the specified array to the end of this list
_.addAll(items,index)
- Inserts all of the elements in the specified array into this list at the specified position.
@example
//list contains [1,2,3]
list.addAll([4,5]); //[1,2,3,4,5]
list.addAll([2.1,2.2,2.3], 2); //[1,2,2.1,2.2,2.3,3,4]
hdr_strong
Implementation of:
List.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
List.clear
_.clone()
- Returns a shallow copy of this ArrayList instance.
@example
let newArrayList = arrayList.clone();
hdr_strong
Implementation of:
Cloneable.clone
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
List.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
List.containsAll
_.ensureCapacity(minCapacity)
- Increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
@example
//arrayList has a capacity 10
arrayList.ensureCapacity(15);
//new capacity is 15
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
List.equals
_.filter(filterFn)
- Returns a new ArrayList after filtering the items based on the filterFn
@example
//arryList [1,2,3,4,5]
arrayList.filter(x => (x < 4)); //returns an ArrayList [1,2,3]
_.filter(filterFn,capacity)
- Returns a new ArrayList after filtering the items based on the filterFn with the given initial capacity
@example
//arryList [1,2,3,4,5]
arrayList.filter(x => (x < 4), 5); //returns an ArrayList [1,2,3] with capacity 5
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
List.forEach
_.fromString(json,deserializerFn)
- Return the Object from the JSON string
@example
//json = "[1,2,3,4]"
arrayList = new ArrayList<number>().fromString(json,(x)=>(parseFloat(x)));
//arrayList contains [1,2,3,4]
hdr_strong
Implementation of:
Serializable.fromString
_.get(index)
- Read an item from the list
@example
//list contains [1,2,3]
console.log(list.get(2));
//Output: 3
hdr_strong
Inherited from:
AbstractList.get
hdr_strong
Implementation of:
List.get
_.indexOf(item)
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
@example
//list contains [1,2,3,2,4]
console.log(list.indexOf(2));
//Output: 1
hdr_strong
Inherited from:
AbstractList.indexOf
hdr_strong
Implementation of:
List.indexOf
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
List.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
List.iterator
_.lastIndexOf(item)
- Returns the index of last occurrence of the element.
//list contains [1,2,3,2,4]
console.log(list.lastIndexOf(2));
//Output: 3
hdr_strong
Inherited from:
AbstractList.lastIndexOf
hdr_strong
Implementation of:
List.lastIndexOf
_.median()
- Returns the median of this list. If the list is empty returns undefined.
In case of two medians the later one is preferred.
@example
//list contains [1, 2, 3, 4]
list.median(); //returns 3
hdr_strong
Inherited from:
AbstractList.median
hdr_strong
Implementation of:
List.median
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
List.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
List.removeAll
_.removeAt(index)
- Removes the element at the specified position in this list.
@example
//list contains [1,2,3]
console.log(list.removeAt(1)); //[1,3]
//Output: 2
hdr_strong
Inherited from:
AbstractList.removeAt
hdr_strong
Implementation of:
List.removeAt
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
List.removeIf
_.removeRange(fromIndex,toIndex)
- Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.
@example
//list contains [1,2,3,4,5,6]
console.log(list.removeRange(1,4)); //[1,5,6]
//Output: [2,3,4]
hdr_strong
Inherited from:
AbstractList.removeRange
_.replaceAll(mappingFn)
- Replaces each element of this list with the result of applying the mapping function
@example
//arrayList contains [1,2,3,4]
arrayList.map((x)=>(x*2));
//now arrayList contains [2,4,6,8]
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
List.retainAll
_.reverse()
- Reverse the list.
@example
//list contains [1,2,3,4,5]
list.reverse() //now list contains [5,4,3,2,1]
hdr_strong
Inherited from:
AbstractList.reverse
hdr_strong
Implementation of:
List.reverse
_.set(index,item)
- Replaces the element at the specified position in this list with the specified element
@example
//list contains [1,2,3]
console.log(list.set(1,2.5)); //[1,2.5,3]
//Output: 2
hdr_strong
Inherited from:
AbstractList.set
hdr_strong
Implementation of:
List.set
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
List.size
_.sort(compareFn)
- Sorts this list according to the compareFn.
compareFn is a function which should return a number value (-ve, zero, or +ve).
x is considered smaller than y if the compareFn(x,y) is negetive
@example
//list contains [1,8,6,2,7,3,9,11]
list.sort(function(x,y) {
return x-y;
}); // [1, 2, 3, 6, 7, 8, 9, 11]
hdr_strong
Inherited from:
AbstractList.sort
hdr_strong
Implementation of:
List.sort
_.subList(fromIndex,toIndex)
- Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
@example
//list contains [1,8,6,2,7,3,9,11]
list.subList(2,7); // returns a list containing [6, 2, 7, 3, 9]
hdr_strong
Implementation of:
List.subList
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
List.toArray
_.toString(serializerFn)
- Converts the arrayList into a JSON String
@example
//arrayList contains [1,2,3,4]
console.log(arrayList.toString((x)=>(x.toString())));
//Output
//"[1,2,3,4]"
hdr_strong
Implementation of:
Serializable.toString
_.trimToSize()
- Trims the capacity of this ArrayList instance to be the list's current size.
@example
//arrayList contains [1,2,3,4,5] and capacity is 10
arrayList.trimToSize(); //new capacity is 5
donut_small ArrayMap<K,V>
hdr_strong
Extends:
AbstractMap
new ArrayMap<K,V>()
new ArrayMap<K,V>(initialCapacity)
new ArrayMap<K,V>(initialCapacity,...items)
play_circle_outline "ArrayMap" Methods
_.clear()
- Removes all of the mappings from this map.
@example
//map: [{"1":1},{"2":2},{"3":3}]
map.clear();
//now : []
hdr_strong
Inherited from:
AbstractMap.clear
hdr_strong
Implementation of:
Map.clear
_.clone()
- Returns a shallow copy of this ArrayMap instance.
@example
let newArrayMap = arrayMap.clone();
hdr_strong
Implementation of:
Cloneable.clone
_.compute(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to 12
map.compute(k1, (key,value,map)=>(value+11)); //returns 12
//now the value changes to 12+11 -> 23
hdr_strong
Inherited from:
AbstractMap.compute
hdr_strong
Implementation of:
Map.compute
_.computeIfAbsent(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to 12
map.computeIfAbsent(k1, (key,value,map)=>(23)); //returns 12
//value does not change
hdr_strong
Inherited from:
AbstractMap.computeIfAbsent
hdr_strong
Implementation of:
Map.computeIfAbsent
_.computeIfPresent(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to null
map.computeIfAbsent(k1, (key,value,map)=>(value+11)); //returns null
//value does not change
hdr_strong
Inherited from:
AbstractMap.computeIfPresent
hdr_strong
Implementation of:
Map.computeIfPresent
_.containsKey(key)
- Returns true if this map contains a mapping for the specified key.
@example
//map : [{k1:1},{k2:2}]
map.conainsKey(k1); //returns true
map.containsKey(k5); //returns false
hdr_strong
Inherited from:
AbstractMap.containsKey
hdr_strong
Implementation of:
Map.containsKey
_.containsValue(value)
- Returns true if this map maps one or more keys to the specified value.
@example
//map : [{k1:1},{k2:2}]
map.conainsValue(1); //returns true
map.containsValue(5); //returns false
hdr_strong
Inherited from:
AbstractMap.containsValue
hdr_strong
Implementation of:
Map.containsValue
_.ensureCapacity(minCapacity)
- Increases the capacity of this ArrayMap instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
@example
//arrayMap has a capacity 10
arrayMap.ensureCapacity(15);
//new capacity is 15
_.entrySet()
- Returns a Set view of the mappings contained in this map.
@example
//map : [{k1:1},{k2:2}]
map.entrySet(); //returns Set [{key:k1, value:1},{key:k2, value:2}]
hdr_strong
Inherited from:
AbstractMap.entrySet
hdr_strong
Implementation of:
Map.entrySet
_.equals(map)
- Compares the specified map with this map for equality.
@example
//map1 : [{k1:1},{k2:2},{k3:null}]
//map2 : [{k1:1},{k3:4}]
map1.equals(map2) //returns false
hdr_strong
Inherited from:
AbstractMap.equals
hdr_strong
Implementation of:
Map.equals
_.forEach(action)
- Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.forEach((key, value, map)=>{
console.log(key+"->"+value+",");
});
//Output: one->1,two->2,three->3
hdr_strong
Inherited from:
AbstractMap.forEach
hdr_strong
Implementation of:
Map.forEach
_.get(key)
- Returns the value to which the specified key is mapped. undefined if there is no mapping.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.get(k1); //returns 1
map.get(k3); //returns null
map.get(k4); //returns undefined
hdr_strong
Inherited from:
AbstractMap.get
hdr_strong
Implementation of:
Map.get
_.getOrDefault(key,defaultValue)
- Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key or if key is mapped to null.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.getOrDefault(k1,5); //returns 1
map.getOrDefault(k3,12); //returns 12
map.getOrDefault(k4,16); //returns 16
hdr_strong
Inherited from:
AbstractMap.getOrDefault
hdr_strong
Implementation of:
Map.getOrDefault
_.isEmpty()
- Returns true if this map contains no key-value mappings.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.isEmpty(); //false
//map : [{k1:null},{k2:null},{k3:null}]
map.isEmpty(); //false
//map : []
map.isEmpty(); //true
hdr_strong
Inherited from:
AbstractMap.isEmpty
hdr_strong
Implementation of:
Map.isEmpty
_.isNull()
- Returns true if this map contains mappings to only null values or if the map is empty.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.isNull(); //false
//map : [{k1:null},{k2:null},{k3:null}]
map.isNull(); //true
//map : []
map.isNull(); //true
hdr_strong
Inherited from:
AbstractMap.isNull
_.keySet()
- Returns a Set view of the keys contained in this map.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.keySet(); //["one","two","three"]
hdr_strong
Inherited from:
AbstractMap.keySet
hdr_strong
Implementation of:
Map.keySet
_.put(key,value)
- Associates the specified value with the specified key in this map.Returns the old value associated with the key or undefined.
(Throws an Error if ArrayMap is at maximum capacity)
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.put("one",22); //return 1
//now map : [{"one":22},{"two":2},{"three":3}]
map.put("four",4);//return undefined
//now map : [{"one":22},{"two":2},{"three":3},{"four":4}]
hdr_strong
Implementation of:
Map.put
_.putAll(map)
- Copies all of the mappings from the specified map to this map.
@example
//map1: [{k1:v1},{k2:v2},{k3:v3}], map2: [{k2:v4},{k4:v6},{k6:v8}]
map1.putAll(map2);
//now map1: [{k1:v1},{k2:v4},{k3:v3},{k4:v6},{k6:v8}]
hdr_strong
Inherited from:
AbstractMap.putAll
hdr_strong
Implementation of:
Map.putAll
_.putIfAbsent(key,value)
- If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns undefined, else returns the current value.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.putIfAbsent("four",4); //return undefined (adds {"four":4} to the map)
map.putIfAbsent("one",23); //return 1 (map unchanged)
hdr_strong
Inherited from:
AbstractMap.putIfAbsent
hdr_strong
Implementation of:
Map.putIfAbsent
_.remove(key)
- Removes the mapping for a key from this map if it is present.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.remove("one"); //return 1
//now map : [{"two":2},{"three":3}]
map.remove("four"); //return undefined (map unchanged)
hdr_strong
Inherited from:
AbstractMap.remove
hdr_strong
Implementation of:
Map.remove
_.removeIf(key,value)
- Removes the entry for the specified key only if it is currently mapped to the specified value.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.removeIf("one", 1); //return true
//now map : [{"two":2},{"three":3}]
map.removeIf("two",5); //return false (map unchanged)
map.removeIf("four",4); //return false
hdr_strong
Inherited from:
AbstractMap.removeIf
hdr_strong
Implementation of:
Map.removeIf
_.replace(oldValue,newValue)
- Replace all entries with specified value with the new value. Returns true if map was changed.
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.replace(5,2) //returns true;
//now map : [{k1:1},{k2:2},{k3:3},{k4:2},{k5:1}]
hdr_strong
Inherited from:
AbstractMap.replace
hdr_strong
Implementation of:
Map.replace
_.replaceAll(remappingFn)
- Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.replaceAll((k,v,m)=>(v*2)); //replace with its double
//map : [{k1:2},{k2:10},{k3:6},{k4:10},{k5:2}]
hdr_strong
Inherited from:
AbstractMap.replaceAll
hdr_strong
Implementation of:
Map.replaceAll
_.size()
- Returns the number of key-value mappings in this map.(key->null mappings are counted)
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.size(); //return 5
hdr_strong
Inherited from:
AbstractMap.size
hdr_strong
Implementation of:
Map.size
_.subMap(selectionFn)
- Returns a sub map of the current map based on the selection function
@example
//arrayMap contains [{"one":1},{"two":2},{"three":3}]
arrayMap.subMap((k,v) => (v<=2)); //returns [{"one":1},{"two":2}]
_.trimToSize()
- Trims the capacity of this ArrayMap instance to be the list's current size.
@example
//arrayMap contains [{"one":1},{"two":2},{"three":3}] and capacity is 10
arrayMap.trimToSize(); //new capacity is 3
_.values()
- Returns a List view of the values contained in this map.
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.values(); //return list : [1,5,3,5,1]
hdr_strong
Inherited from:
AbstractMap.values
hdr_strong
Implementation of:
Map.values
donut_small ArrayMatrix<E>
- A 2 dimensional array implementation of Matrix.
hdr_weak
Extended By:
NumberMatrix
new ArrayMatrix<E>(height,width)
new ArrayMatrix<E>(height,width,defaultValue)
play_circle_outline "ArrayMatrix" Methods
_.clone()
- Create a copy of the current object and return
@example
matrix.clone();
hdr_strong
Implementation of:
Cloneable.clone
_.col(index)
- Returns the column correponding to the specified index.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.col(1); //[2,5,8]
_.equals(matrix)
- Check whether the specified matrix is equal to this matrix.
@example
// m1:
// [1 2]
// [2 3]
// m2:
// [1 2]
// [2 3]
m1.equals(m2); //returns true
hdr_strong
Implementation of:
Matrix.equals
_.get(rowIndex,columnIndex)
- Read the item at the specified position in this matrix.
@example
// [1 2 3]
// [2 3 4]
// [3 4 5]
matrix.get(1,1); //3
hdr_strong
Implementation of:
Matrix.get
_.height()
- Returns the number of rows in this matrix.
@example
matrix.height(); //return 3
hdr_strong
Implementation of:
Matrix.height
_.put(rowIndex,columnIndex,item)
- Insert an item at the specified position in this matrix.
@example
// [1 2 3]
// [2 3 4]
// [3 4 5]
matrix.put(0,1,5);
// [1 2 3]
// [5 3 4]
// [3 4 5]
hdr_strong
Implementation of:
Matrix.put
_.row(index)
- Returns the row correponding to the specified index.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.row(1); //[4,5,6]
_.subMatrix(rows,cols)
- Returns the submatrix obtained after removing the specified rows and columns from this matrix.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.subMatrix([0],[1])
// [4 6]
// [7 9]
hdr_strong
Implementation of:
Matrix.subMatrix
_.toArray()
- Return a 2 dimensional array corresponding to the matrix.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.toArray(); //[[1,2,3],[4,5,6],[7,8,9]]
_.transpose()
- Returns the transpose of this matrix.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.transpose();
// [1 4 7]
// [2 5 8]
// [3 6 9]
hdr_strong
Implementation of:
Matrix.transpose
_.width()
- Returns the number of columns in this matrix.
@example
matrix.width(); //return 3
hdr_strong
Implementation of:
Matrix.width
donut_small ArrayMatrixColumn<E>
- A single column of an ArrayMatrix.
hdr_strong
Implements:
MatrixColumn
hdr_weak
Extended By:
NumberMatrixColumn
new ArrayMatrixColumn<E>(matrix,index)
swap_horiz "ArrayMatrixColumn" Accessors
_.index
- Return the index of this colun in the matrix it belongs to.
_.matrix
- Return the matrix to which this column belong.
play_circle_outline "ArrayMatrixColumn" Methods
_.change(col)
- Change this matrix column with another column of same matrix.
@example
//am:ArrayMatrix
let c1 = am.col(0);
let c2 = am.col(1);
c1.change(c2); // corresponds to C1 -> C2
hdr_strong
Implementation of:
MatrixColumn.change
_.interchange(col)
- Interchange this column with another column of the same matrix.
@example
//am:ArrayMatrix
let c1 = am.col(0);
let c2 = am.col(1);
c1.interchange(c2); // corresponds to C1 <-> C2
hdr_strong
Implementation of:
MatrixColumn.interchange
_.toArray()
- Return an array corresponding to this column.
@example
//am:ArrayMatrix
// [1 1 1]
// [0 1 1]
// [0 0 1]
am.col(1).toArray() // [1,1,0]
donut_small ArrayMatrixRow<E>
- A single row of an ArrayMatrix.
hdr_strong
Implements:
MatrixRow
hdr_weak
Extended By:
NumberMatrixRow
new ArrayMatrixRow<E>(matrix,index)
swap_horiz "ArrayMatrixRow" Accessors
_.index
- Return the index of this row in the matrix it belongs to.
_.matrix
- Return the matrix to which this row belong.
play_circle_outline "ArrayMatrixRow" Methods
_.change(row)
- Change this matrix row with another row of same matrix.
@example
//am:ArrayMatrix
let r1 = am.row(0);
let r2 = am.row(1);
r1.change(r2); // corresponds to R1 -> R2
hdr_strong
Implementation of:
MatrixRow.change
_.interchange(row)
- Interchange this row with another row of the same matrix.
@example
//am:ArrayMatrix
let r1 = am.row(0);
let r2 = am.row(1);
r1.interchange(r2); // corresponds to R1 <-> R2
hdr_strong
Implementation of:
MatrixRow.interchange
_.toArray()
- Return an array corresponding to this row.
@example
//am:ArrayMatrix
// [1 0 0]
// [0 1 0]
// [0 0 1]
am.row(1).toArray() // [0,1,0]
donut_small BinarySearchTree<E>
hdr_strong
Extends:
AbstractBinaryTree
hdr_strong
Implements:
BinaryTree
new BinarySearchTree<E>(compareFn)
new BinarySearchTree<E>(compareFn,label)
play_circle_outline "BinarySearchTree" Methods
_.comparator()
- Returns the compare function used to order the elements in this BST.
@example
bst.comparator(); //returns a function
_.delete(item)
- Delete an item from the BST.
@example
//bst:BinarySearchTree<number> : inorder -> 1,5,8,9,11
bst.delete(5); //inorder -> 1,8,9,10,11
hdr_strong
Implementation of:
BinaryTree.delete
_.height(node)
- Returns the height of this binary tree.
@example
bt.height();// returns a number.
hdr_strong
Inherited from:
AbstractBinaryTree.height
hdr_strong
Implementation of:
BinaryTree.height
_.inorder(node)
- Returns the list of items obtained after inorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.inorder();
hdr_strong
Inherited from:
AbstractBinaryTree.inorder
hdr_strong
Implementation of:
BinaryTree.inorder
_.insert(item)
- Insert a new item to the BST.
@example
//bst:BinarySearchTree<number> : inorder -> 1,5,8,9,11
bst.insert(10); //inorder -> 1,5,8,9,10,11
hdr_strong
Implementation of:
BinaryTree.insert
_.insertMultiple(...items)
- Insert multiple items to the BST.
@example
//bst:BinarySearchTree<number> : inorder -> 1,5,8,9,11
bst.insertMultiple(10,21,3,15); //inorder -> 1,3,5,8,9,10,11,15,21
_.postorder(node)
- Returns the list of items obtained after postorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.postorder();
hdr_strong
Inherited from:
AbstractBinaryTree.postorder
hdr_strong
Implementation of:
BinaryTree.postorder
_.preorder(node)
- Returns the list of items obtained after preorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.preorder();
hdr_strong
Inherited from:
AbstractBinaryTree.preorder
hdr_strong
Implementation of:
BinaryTree.preorder
_.search(item)
- Search an item in the tree. Returns the item if found else returns null.
@example
bst.search(25);
donut_large BinaryTree<E>
- A data structure in which a record is linked to two successor records, usually referred to as the left branch when greater and the right when less than the previous record.
hdr_strong
Extends:
Tree
play_circle_outline "BinaryTree" Methods
_.delete(item)
- Delete an item from the tree.
_.height()
- Returns the height of this binary tree.
_.inorder()
- Returns the list of items obtained after inorder traversal of the tree.
_.insert(item)
- Insert a new item to the tree.
_.postorder()
- Returns the list of items obtained after postorder traversal of the tree.
_.preorder()
- Returns the list of items obtained after preorder traversal of the tree.
donut_small BinaryTreeNode<E>
- A Node in a Binary Tree dataStructure
hdr_weak
Extended By:
RopeNode
new BinaryTreeNode<E>(label)
new BinaryTreeNode<E>(label,left,right)
donut_large Cloneable<T>
- Classes that implements this interface must have a clone method.
hdr_weak
Implemented By:
ArrayList
ArrayMap
ArrayMatrix
Dictionary
HistoryList
NumberMatrix
SquareMatrix
SwappableList
donut_large Collection<T>
- Collection is a set of elements of same type.
hdr_strong
Extends:
Iterable
hdr_weak
Implemented By:
AbstractCollection
AbstractList
AbstractQueue
AbstractSet
AbstractSortedSet
ArrayList
HistoryList
PriorityQueue
SwappableList
play_circle_outline "Collection" Methods
_.__@iterator()
hdr_strong
Inherited from:
Iterable.[Symbol.iterator]
_.add(item)
- Add an item to collection
_.addAll(items)
- Add all items of an array to collection
_.clear()
- Removes all of the elements from this collection
_.contains(item)
- Returns true if this collection contains the specified element.
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
_.equals(collection)
- Compares the specified object with this collection for equality.
_.forEach(action)
- Performs an action for each item in this collection.
_.isEmpty()
- Returns true if this collection contains no elements.
_.iterator()
- iterator
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
_.size()
- Returns the number of elements in this collection.
_.toArray()
- Returns an array containing all of the elements in this collection
donut_small DataTable<V>
- An entry table with enumerable rowKeys (number) and string columnKeys.
hdr_strong
Extends:
EntryTable
hdr_strong
Implements:
Table
new DataTable<V>()
play_circle_outline "DataTable" Methods
_.add(rowKey,row)
- Add a row to this table only if row curresponding to given key is absent.
@example
//t:Table<number,number,string>
var r = new ArrayMap<number,string>(5);
r.add(1,'01');
r.add(2,'02');
r.add(3,'03');
t.add(0, r);
/*
+-----+-----+-----+-----+
| X | 1 | 2 | 3 |
+-----+-----+-----+-----+
| 0 | 01 | 02 | 03 |
+-----+-----+-----+-----+
hdr_strong
Inherited from:
AbstractTable.add
hdr_strong
Implementation of:
Table.add
_.attributes()
- Return the set of all column keys of this table.
@example
t.attributes(); //returns <Set>{1,2,3}
hdr_strong
Inherited from:
EntryTable.attributes
_.delete(rowKey)
- Delete an entire row from this table.
@example
t.delete(0); //calling this function makes the table empty.
hdr_strong
Inherited from:
AbstractTable.delete
hdr_strong
Implementation of:
Table.delete
_.deleteIf(filterFn)
- Delete an entire row from this table based on filter function.
@example
t.deleteIf((rowKey, row) => (row.get(2)=='02')); //delete all rows with value '02' in the cell correspondin to column 2.
hdr_strong
Inherited from:
EntryTable.deleteIf
hdr_strong
Implementation of:
Table.deleteIf
_.drop(columnKey)
- Delete an entire column from this table.
@example
t.drop(2);
/*
+-----+-----+-----+
| X | 1 | 3 |
+-----+-----+-----+
| 0 | 01 | 03 |
+-----+-----+-----+
hdr_strong
Inherited from:
AbstractTable.drop
hdr_strong
Implementation of:
Table.drop
_.extract(columnKey)
- Read an entire column of this table.
@example
t.extract(2); //returns <Map>[{0:'02'}]
t.extract(5); //returns <Map>[{0: undefined}]
hdr_strong
Inherited from:
AbstractTable.extract
hdr_strong
Implementation of:
Table.extract
_.fetch(rowKey)
- Read an entire row of this table.
@example
t.fetch(0); //returns <Map>[{1:'01'},{2:'02'},{3:'03'}]
t.fetch(1); //returns undefined
hdr_strong
Inherited from:
AbstractTable.fetch
hdr_strong
Implementation of:
Table.fetch
_.get(rowKey,columnKey)
- Read an entry from this table.
@example
t.get(0,3); //returns '03'
hdr_strong
Inherited from:
AbstractTable.get
hdr_strong
Implementation of:
Table.get
_.indexes()
- Return the set of all row keys of this table.
@example
t.indexes(); //returns <Set>{0}
hdr_strong
Inherited from:
EntryTable.indexes
_.insert(row)
- Insert a new row at the end of this table.
@example
var t = new DataTable<string>();
var r = new ArrayMap<number,string>(5);
r.add("a",'0a');
r.add("b",'0b');
r.add("c",'0c');
t.insert(r);
/*
+-----+-----+-----+-----+
| X | a | b | c |
+-----+-----+-----+-----+
| 0 | 0a | 0b | 0c |
+-----+-----+-----+-----+
_.limit(n)
- Returns the first n rows in the table.
@example
t.limit(5); //return first 5 rows of the table.
_.limitLast(n)
- Returns the last n rows of this table.
@example
t.limitLast(5); //return last 5 rows
_.num_rows()
- Returns the number of rows in this table.
@example
t.num_rows(); //returns 1
_.project(columns)
- Return a subset of columns in this table based on the filter function.
@example
t.project([1,3]); //project only columns 1 and 3
hdr_strong
Inherited from:
EntryTable.project
hdr_strong
Implementation of:
Table.project
_.remove(rowKey,columnKey)
- Remove an entry from this table.
@example
t.remove(0,3); //returns '03' and removes it from the table
hdr_strong
Inherited from:
AbstractTable.remove
hdr_strong
Implementation of:
Table.remove
_.select(filterFn)
- Return a subset of rows in this table based on the filter function.
@example
t.select((rowKey,row)=>(key>2)); //selects and returns all rows with associated key > 2
hdr_strong
Inherited from:
EntryTable.select
hdr_strong
Implementation of:
Table.select
_.set(rowKey,columnKey,value)
- Replaces the value at the specified position in this table with the specified value.
@example
t.set(0,2,'2'); //returns '02'
t.set(1,2,'12'); //returns undefined
/*
+-----+-----+-----+-----+
| X | 1 | 2 | 3 |
+-----+-----+-----+-----+
| 0 | 01 | 2 | 03 |
+-----+-----+-----+-----+
hdr_strong
Inherited from:
AbstractTable.set
hdr_strong
Implementation of:
Table.set
_.subTable(fromIndex,toIndex)
- Return a subset of rows beginning at the fromIndex inclusive and ending at toIndex exclusive.
@example
t.subTable(2,6); //returns table with rows 2,3,4,5
donut_small Dictionary<E>
- A Map whose keys are always of string type.
hdr_strong
Extends:
AbstractMap
new Dictionary<E>(...items)
play_circle_outline "Dictionary" Methods
_.clear()
- Removes all of the mappings from this map.
@example
//map: [{"1":1},{"2":2},{"3":3}]
map.clear();
//now : []
hdr_strong
Inherited from:
AbstractMap.clear
hdr_strong
Implementation of:
Map.clear
_.clone()
- Returns a shallow copy of this Dictionary instance.
@example
let newDict = dict.clone();
hdr_strong
Implementation of:
Cloneable.clone
_.compute(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to 12
map.compute(k1, (key,value,map)=>(value+11)); //returns 12
//now the value changes to 12+11 -> 23
hdr_strong
Inherited from:
AbstractMap.compute
hdr_strong
Implementation of:
Map.compute
_.computeIfAbsent(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to 12
map.computeIfAbsent(k1, (key,value,map)=>(23)); //returns 12
//value does not change
hdr_strong
Inherited from:
AbstractMap.computeIfAbsent
hdr_strong
Implementation of:
Map.computeIfAbsent
_.computeIfPresent(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
@example
//in map key k1 is mapped to null
map.computeIfAbsent(k1, (key,value,map)=>(value+11)); //returns null
//value does not change
hdr_strong
Inherited from:
AbstractMap.computeIfPresent
hdr_strong
Implementation of:
Map.computeIfPresent
_.containsKey(key)
- Returns true if this map contains a mapping for the specified key.
@example
//map : [{k1:1},{k2:2}]
map.conainsKey(k1); //returns true
map.containsKey(k5); //returns false
hdr_strong
Inherited from:
AbstractMap.containsKey
hdr_strong
Implementation of:
Map.containsKey
_.containsValue(value)
- Returns true if this map maps one or more keys to the specified value.
@example
//map : [{k1:1},{k2:2}]
map.conainsValue(1); //returns true
map.containsValue(5); //returns false
hdr_strong
Inherited from:
AbstractMap.containsValue
hdr_strong
Implementation of:
Map.containsValue
_.count(item)
- Returns the number occurances of an item in the dictionary
@example
//dict contains [{'a':1},{'b':2},{'c':3},{'d':2},{'f':1},{'e':2},{'g':4}]
dict.count(2) // returns 3
dict.count(7) // return 0
_.entrySet()
- Returns a Set view of the mappings contained in this map.
@example
//map : [{k1:1},{k2:2}]
map.entrySet(); //returns Set [{key:k1, value:1},{key:k2, value:2}]
hdr_strong
Inherited from:
AbstractMap.entrySet
hdr_strong
Implementation of:
Map.entrySet
_.equals(map)
- Compares the specified map with this map for equality.
@example
//map1 : [{k1:1},{k2:2},{k3:null}]
//map2 : [{k1:1},{k3:4}]
map1.equals(map2) //returns false
hdr_strong
Inherited from:
AbstractMap.equals
hdr_strong
Implementation of:
Map.equals
_.forEach(action)
- Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.forEach((key, value, map)=>{
console.log(key+"->"+value+",");
});
//Output: one->1,two->2,three->3
hdr_strong
Inherited from:
AbstractMap.forEach
hdr_strong
Implementation of:
Map.forEach
_.fromString(json,deserializerFn)
- Return the Object from the JSON string
@example
//json = '{"a":1,"b":2,"c":3}'
dict = new Dictionary<number>().fromString(json,(x)=>(parseFloat(x)));
//dict contains [{'a':1},{'b':2},{'c':3}]
hdr_strong
Implementation of:
Serializable.fromString
_.get(key)
- Returns the value to which the specified key is mapped. undefined if there is no mapping.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.get(k1); //returns 1
map.get(k3); //returns null
map.get(k4); //returns undefined
hdr_strong
Inherited from:
AbstractMap.get
hdr_strong
Implementation of:
Map.get
_.getKeys(item)
- Returns a set of keys associated with a given item
@example
//dict contains [{'a':1},{'b':2},{'c':3},{'d':2},{'f':1},{'e':2},{'g':4}]
dict.getKeys(2) //return a set containing ['b','d','e']
_.getOrDefault(key,defaultValue)
- Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key or if key is mapped to null.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.getOrDefault(k1,5); //returns 1
map.getOrDefault(k3,12); //returns 12
map.getOrDefault(k4,16); //returns 16
hdr_strong
Inherited from:
AbstractMap.getOrDefault
hdr_strong
Implementation of:
Map.getOrDefault
_.isEmpty()
- Returns true if this map contains no key-value mappings.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.isEmpty(); //false
//map : [{k1:null},{k2:null},{k3:null}]
map.isEmpty(); //false
//map : []
map.isEmpty(); //true
hdr_strong
Inherited from:
AbstractMap.isEmpty
hdr_strong
Implementation of:
Map.isEmpty
_.isNull()
- Returns true if this map contains mappings to only null values or if the map is empty.
@example
//map : [{k1:1},{k2:2},{k3:null}]
map.isNull(); //false
//map : [{k1:null},{k2:null},{k3:null}]
map.isNull(); //true
//map : []
map.isNull(); //true
hdr_strong
Inherited from:
AbstractMap.isNull
_.keySet()
- Returns a Set view of the keys contained in this map.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.keySet(); //["one","two","three"]
hdr_strong
Inherited from:
AbstractMap.keySet
hdr_strong
Implementation of:
Map.keySet
_.put(key,value)
- Associates the specified value with the specified key in this map.Returns the old value associated with the key or undefined.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.put("one",22); //return 1
//now map : [{"one":22},{"two":2},{"three":3}]
map.put("four",4);//return undefined
//now map : [{"one":22},{"two":2},{"three":3},{"four":4}]
hdr_strong
Inherited from:
AbstractMap.put
hdr_strong
Implementation of:
Map.put
_.putAll(map)
- Copies all of the mappings from the specified map to this map.
@example
//map1: [{k1:v1},{k2:v2},{k3:v3}], map2: [{k2:v4},{k4:v6},{k6:v8}]
map1.putAll(map2);
//now map1: [{k1:v1},{k2:v4},{k3:v3},{k4:v6},{k6:v8}]
hdr_strong
Inherited from:
AbstractMap.putAll
hdr_strong
Implementation of:
Map.putAll
_.putIfAbsent(key,value)
- If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns undefined, else returns the current value.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.putIfAbsent("four",4); //return undefined (adds {"four":4} to the map)
map.putIfAbsent("one",23); //return 1 (map unchanged)
hdr_strong
Inherited from:
AbstractMap.putIfAbsent
hdr_strong
Implementation of:
Map.putIfAbsent
_.remove(key)
- Removes the mapping for a key from this map if it is present.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.remove("one"); //return 1
//now map : [{"two":2},{"three":3}]
map.remove("four"); //return undefined (map unchanged)
hdr_strong
Inherited from:
AbstractMap.remove
hdr_strong
Implementation of:
Map.remove
_.removeIf(key,value)
- Removes the entry for the specified key only if it is currently mapped to the specified value.
@example
//map : [{"one":1},{"two":2},{"three":3}]
map.removeIf("one", 1); //return true
//now map : [{"two":2},{"three":3}]
map.removeIf("two",5); //return false (map unchanged)
map.removeIf("four",4); //return false
hdr_strong
Inherited from:
AbstractMap.removeIf
hdr_strong
Implementation of:
Map.removeIf
_.replace(oldValue,newValue)
- Replace all entries with specified value with the new value. Returns true if map was changed.
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.replace(5,2) //returns true;
//now map : [{k1:1},{k2:2},{k3:3},{k4:2},{k5:1}]
hdr_strong
Inherited from:
AbstractMap.replace
hdr_strong
Implementation of:
Map.replace
_.replaceAll(remappingFn)
- Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.replaceAll((k,v,m)=>(v*2)); //replace with its double
//map : [{k1:2},{k2:10},{k3:6},{k4:10},{k5:2}]
hdr_strong
Inherited from:
AbstractMap.replaceAll
hdr_strong
Implementation of:
Map.replaceAll
_.size()
- Returns the number of key-value mappings in this map.(key->null mappings are counted)
@example
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.size(); //return 5
hdr_strong
Inherited from:
AbstractMap.size
hdr_strong
Implementation of:
Map.size
_.toString(serializerFn)
- Converts the dictionary into a JSON String
@example
//dictionary contains [{'a':1},{'b':2},{'c':3}]
console.log(arrayList.toString((x)=>(x.toString())));
//Output
//'{"a":1,"b":2,"c":3}'
hdr_strong
Implementation of:
Serializable.toString
_.values()
- Returns a List view of the values contained in this map.
//map : [{k1:1},{k2:5},{k3:3},{k4:5},{k5:1}]
map.values(); //return list : [1,5,3,5,1]
hdr_strong
Inherited from:
AbstractMap.values
hdr_strong
Implementation of:
Map.values
donut_small DiGraph<E>
- A directed graph data structure.
hdr_strong
Extends:
AbstractGraph
hdr_strong
Implements:
Graph
new DiGraph<E>()
play_circle_outline "DiGraph" Methods
_.add(label)
- Add a new vertex with the specified label to this graph.
@example
//g:Graph<number>
g.add(25);
hdr_strong
Inherited from:
AbstractGraph.add
hdr_strong
Implementation of:
Graph.add
_.addAll(labels)
- Add new vertices with the labels present in the specified array.
@example
//g:Graph<number>
g.addAll([25,22,11,43]);
hdr_strong
Inherited from:
AbstractGraph.addAll
hdr_strong
Implementation of:
Graph.addAll
_.addEdge(edge)
- Add the specified edge to the graph. The start and end vertices are added automatically to the graph if not present.
@example
//g:Graph<number>, e:Edge<number>
g.addEdge(e);
hdr_strong
Inherited from:
AbstractGraph.addEdge
hdr_strong
Implementation of:
Graph.addEdge
_.addVertex(vertex)
- Add the specified vertex to the graph.
@example
//g:Graph<number>, v:Vertex<number>
g.addVertex(v);
hdr_strong
Inherited from:
AbstractGraph.addVertex
hdr_strong
Implementation of:
Graph.addVertex
_.addVertices(vertices)
- Add all vertices in the specified array to the graph.
@example
//g:Graph<number>, a,b,c,d:Vertex<number>
g.addVertices([a,b,c,d]);
hdr_strong
Inherited from:
AbstractGraph.addVertices
hdr_strong
Implementation of:
Graph.addVertices
_.adjacentEdges(vertex)
- Returns the set of edges starting from specified vertex.
@example
//g:Graph<number>, v:Vertex<number>
g.adjacentEdges(v);
hdr_strong
Inherited from:
AbstractGraph.adjacentEdges
hdr_strong
Implementation of:
Graph.adjacentEdges
_.adjacentVertices(vertex)
- Returns the set of vertices adjacent to the specified vertex.
@example
//g:Graph<number>, v:Vertex<number>
g.adjacentVertices(v);
hdr_strong
Inherited from:
AbstractGraph.adjacentVertices
hdr_strong
Implementation of:
Graph.adjacentVertices
_.bfs(startVertex)
- BFS Traverse the graph starting from the specified vertex and return the list of vertices.
@example
//dgraph:DGraph<number>
dgraph.bfs(); // returns a List of numbers.
_.createEdge(startLabel,endLabel)
- Create vertices from the given labels and an edge connecting them and add it to the graph.
@example
//g:Graph<number>
g.createEdge(25,26);
hdr_strong
Inherited from:
AbstractGraph.createEdge
hdr_strong
Implementation of:
Graph.createEdge
_.dfs(startVertex)
- DFS Traverse the graph starting from the specified vertex and return the list of vertices.
@example
//dgraph:DGraph<number>
dgraph.dfs(); // returns a List of numbers.
_.edgeSet()
- Returns the set of edges present in the graph.
@example
//g:Graph<number>
g.edgeSet();
hdr_strong
Inherited from:
AbstractGraph.edgeSet
hdr_strong
Implementation of:
Graph.edgeSet
_.remove(label)
- Remove a single vertex with the specified label from the graph.
@example
//g:Graph<number>
g.remove(25);
hdr_strong
Inherited from:
AbstractGraph.remove
hdr_strong
Implementation of:
Graph.remove
_.removeEdge(edge)
- Remove the specified edge from the graph.
@example
//g:Graph<number>, e:Edge<number>
g.removeEdge(e);
hdr_strong
Inherited from:
AbstractGraph.removeEdge
hdr_strong
Implementation of:
Graph.removeEdge
_.removeVertex(vertex)
- Remove the specified vertex from the graph.
@example
//g:Graph<number>, v:Vertex<number>
g.removeVertex(v);
hdr_strong
Inherited from:
AbstractGraph.removeVertex
hdr_strong
Implementation of:
Graph.removeVertex
_.vertexSet()
- Returns the set of vertices present in the graph.(a copy of the set is returned).
@example
//g:Graph<number>
g.vertexSet();
hdr_strong
Inherited from:
AbstractGraph.vertexSet
hdr_strong
Implementation of:
Graph.vertexSet
donut_small Edge<E>
- An Edge in graph datastructure.
new Edge<E>(start,end)
donut_small EntryTable<R,C,V>
- Entry Table is mapping from a set of row and column keys to a value.
hdr_strong
Extends:
AbstractTable
hdr_strong
Implements:
Table
hdr_weak
Extended By:
DataTable
new EntryTable<R,C,V>()
play_circle_outline "EntryTable" Methods
_.add(rowKey,row)
- Add a row to this table only if row curresponding to given key is absent.
@example
//t:Table<number,number,string>
var r = new ArrayMap<number,string>(5);
r.add(1,'01');
r.add(2,'02');
r.add(3,'03');
t.add(0, r);
/*
+-----+-----+-----+-----+
| X | 1 | 2 | 3 |
+-----+-----+-----+-----+
| 0 | 01 | 02 | 03 |
+-----+-----+-----+-----+
hdr_strong
Inherited from:
AbstractTable.add
hdr_strong
Implementation of:
Table.add
_.attributes()
- Return the set of all column keys of this table.
@example
t.attributes(); //returns <Set>{1,2,3}
_.delete(rowKey)
- Delete an entire row from this table.
@example
t.delete(0); //calling this function makes the table empty.
hdr_strong
Inherited from:
AbstractTable.delete
hdr_strong
Implementation of:
Table.delete
_.deleteIf(filterFn)
- Delete an entire row from this table based on filter function.
@example
t.deleteIf((rowKey, row) => (row.get(2)=='02')); //delete all rows with value '02' in the cell correspondin to column 2.
hdr_strong
Implementation of:
Table.deleteIf
_.drop(columnKey)
- Delete an entire column from this table.
@example
t.drop(2);
/*
+-----+-----+-----+
| X | 1 | 3 |
+-----+-----+-----+
| 0 | 01 | 03 |
+-----+-----+-----+
hdr_strong
Inherited from:
AbstractTable.drop
hdr_strong
Implementation of:
Table.drop
_.extract(columnKey)
- Read an entire column of this table.
@example
t.extract(2); //returns <Map>[{0:'02'}]
t.extract(5); //returns <Map>[{0: undefined}]
hdr_strong
Inherited from:
AbstractTable.extract
hdr_strong
Implementation of:
Table.extract
_.fetch(rowKey)
- Read an entire row of this table.
@example
t.fetch(0); //returns <Map>[{1:'01'},{2:'02'},{3:'03'}]
t.fetch(1); //returns undefined
hdr_strong
Inherited from:
AbstractTable.fetch
hdr_strong
Implementation of:
Table.fetch
_.get(rowKey,columnKey)
- Read an entry from this table.
@example
t.get(0,3); //returns '03'
hdr_strong
Inherited from:
AbstractTable.get
hdr_strong
Implementation of:
Table.get
_.indexes()
- Return the set of all row keys of this table.
@example
t.indexes(); //returns <Set>{0}
_.project(columns)
- Return a subset of columns in this table based on the filter function.
@example
t.project([1,3]); //project only columns 1 and 3
hdr_strong
Implementation of:
Table.project
_.remove(rowKey,columnKey)
- Remove an entry from this table.
@example
t.remove(0,3); //returns '03' and removes it from the table
hdr_strong
Inherited from:
AbstractTable.remove
hdr_strong
Implementation of:
Table.remove
_.select(filterFn)
- Return a subset of rows in this table based on the filter function.
@example
t.select((rowKey,row)=>(key>2)); //selects and returns all rows with associated key > 2
hdr_strong
Implementation of:
Table.select
_.set(rowKey,columnKey,value)
- Replaces the value at the specified position in this table with the specified value.
@example
t.set(0,2,'2'); //returns '02'
t.set(1,2,'12'); //returns undefined
/*
+-----+-----+-----+-----+
| X | 1 | 2 | 3 |
+-----+-----+-----+-----+
| 0 | 01 | 2 | 03 |
+-----+-----+-----+-----+
hdr_strong
Inherited from:
AbstractTable.set
hdr_strong
Implementation of:
Table.set
donut_large Graph<E>
- A graph is a pictorial representation of a set of objects where some pairs of objects are connected by links.
The interconnected objects are represented by points termed as vertices, and the links that connect the vertices are called edges.
play_circle_outline "Graph" Methods
_.add(label)
- Add a new vertex with the specified label to this graph.
_.addAll(labels)
- Add new vertices with the labels present in the specified array.
_.addEdge(edge)
- Add the specified edge to the graph. The start and end vertices are added automatically to the graph if not present.
_.addVertex(vertex)
- Add the specified vertex to the graph.
_.addVertices(vertices)
- Add all vertices in the specified array to the graph.
_.adjacentEdges(vertex)
- Returns the set of edges starting from specified vertex.
_.adjacentVertices(vertex)
- Returns the set of vertices adjacent to the specified vertex.
_.createEdge(startLabel,endLabel)
- Create vertices from the given labels and an edge connecting them and add it to the graph.
_.edgeSet()
- Returns the set of edges present in the graph.
_.remove(label)
- Remove a single vertex with the specified label from the graph.
_.removeEdge(edge)
- Remove the specified edge from the graph.
_.removeVertex(vertex)
- Remove the specified vertex from the graph.
_.vertexSet()
- Returns the set of vertices present in the graph.
donut_small HistoryList<E>
- A list of limited size 'n' that stores only the last n items.
hdr_strong
Extends:
ArrayList
new HistoryList<E>()
new HistoryList<E>(initialCapacity)
new HistoryList<E>(initialCapacity,...items)
play_circle_outline "HistoryList" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
List.__@iterator
_.add(item)
- Appends the specified element to the end of this list
@example
//list contains [1,2,3,4,5,6] -capacity 6
list.add(7); //[2,3,4,5,6,7]
hdr_strong
Implementation of:
List.add
_.addAll(items)
- Appends all of the elements in the specified array to the end of this list
@example
//list contains [1,2,3,4,5] - capacity 6
list.addAll([6,7]); //[2,3,4,5,6,7]
hdr_strong
Implementation of:
List.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
List.clear
_.clearUntill(n)
- Clear old items in the history list retaining the last n elements.
@example
//list contains [1,2,3,4,5]
list.clearUntil(2); //return [1,2,3]
//now list contain [4,5]
_.clone()
- Returns a shallow copy of this ArrayList instance.
@example
let newArrayList = arrayList.clone();
hdr_strong
Inherited from:
ArrayList.clone
hdr_strong
Implementation of:
Cloneable.clone
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
List.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
List.containsAll
_.ensureCapacity(minCapacity)
- Increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
@example
//arrayList has a capacity 10
arrayList.ensureCapacity(15);
//new capacity is 15
hdr_strong
Inherited from:
ArrayList.ensureCapacity
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
List.equals
_.filter(filterFn)
- Returns a new ArrayList after filtering the items based on the filterFn
@example
//arryList [1,2,3,4,5]
arrayList.filter(x => (x < 4)); //returns an ArrayList [1,2,3]
_.filter(filterFn,capacity)
- Returns a new ArrayList after filtering the items based on the filterFn with the given initial capacity
@example
//arryList [1,2,3,4,5]
arrayList.filter(x => (x < 4), 5); //returns an ArrayList [1,2,3] with capacity 5
hdr_strong
Inherited from:
ArrayList.filter
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
List.forEach
_.fromString(json,deserializerFn)
- Return the Object from the JSON string
@example
//json = "[1,2,3,4]"
arrayList = new ArrayList<number>().fromString(json,(x)=>(parseFloat(x)));
//arrayList contains [1,2,3,4]
hdr_strong
Inherited from:
ArrayList.fromString
hdr_strong
Implementation of:
Serializable.fromString
_.get(index)
- Read an item from the list
@example
//list contains [1,2,3]
console.log(list.get(2));
//Output: 3
hdr_strong
Inherited from:
AbstractList.get
hdr_strong
Implementation of:
List.get
_.indexOf(item)
- Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element
@example
//list contains [1,2,3,2,4]
console.log(list.indexOf(2));
//Output: 1
hdr_strong
Inherited from:
AbstractList.indexOf
hdr_strong
Implementation of:
List.indexOf
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
List.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
List.iterator
_.lastIndexOf(item)
- Returns the index of last occurrence of the element.
//list contains [1,2,3,2,4]
console.log(list.lastIndexOf(2));
//Output: 3
hdr_strong
Inherited from:
AbstractList.lastIndexOf
hdr_strong
Implementation of:
List.lastIndexOf
_.median()
- Returns the median of this list. If the list is empty returns undefined.
In case of two medians the later one is preferred.
@example
//list contains [1, 2, 3, 4]
list.median(); //returns 3
hdr_strong
Inherited from:
AbstractList.median
hdr_strong
Implementation of:
List.median
_.recent(n)
- Returns the recent (last) n items from the list
@example
//list contains [1,2,3,4,5]
list.recent(3); //[3,4,5]
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
List.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
List.removeAll
_.removeAt(index)
- Removes the element at the specified position in this list.
@example
//list contains [1,2,3]
console.log(list.removeAt(1)); //[1,3]
//Output: 2
hdr_strong
Inherited from:
AbstractList.removeAt
hdr_strong
Implementation of:
List.removeAt
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
List.removeIf
_.removeRange(fromIndex,toIndex)
- Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.
@example
//list contains [1,2,3,4,5,6]
console.log(list.removeRange(1,4)); //[1,5,6]
//Output: [2,3,4]
hdr_strong
Inherited from:
AbstractList.removeRange
_.replaceAll(mappingFn)
- Replaces each element of this list with the result of applying the mapping function
@example
//arrayList contains [1,2,3,4]
arrayList.map((x)=>(x*2));
//now arrayList contains [2,4,6,8]
hdr_strong
Inherited from:
ArrayList.replaceAll
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
List.retainAll
_.reverse()
- Reverse the list.
@example
//list contains [1,2,3,4,5]
list.reverse() //now list contains [5,4,3,2,1]
hdr_strong
Inherited from:
AbstractList.reverse
hdr_strong
Implementation of:
List.reverse
_.set(index,item)
- Replaces the element at the specified position in this list with the specified element
@example
//list contains [1,2,3]
console.log(list.set(1,2.5)); //[1,2.5,3]
//Output: 2
hdr_strong
Inherited from:
AbstractList.set
hdr_strong
Implementation of:
List.set
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
List.size
_.sort(compareFn)
- Sorts this list according to the compareFn.
compareFn is a function which should return a number value (-ve, zero, or +ve).
x is considered smaller than y if the compareFn(x,y) is negetive
@example
//list contains [1,8,6,2,7,3,9,11]
list.sort(function(x,y) {
return x-y;
}); // [1, 2, 3, 6, 7, 8, 9, 11]
hdr_strong
Inherited from:
AbstractList.sort
hdr_strong
Implementation of:
List.sort
_.subList(fromIndex,toIndex)
- Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
@example
//list contains [1,8,6,2,7,3,9,11]
list.subList(2,7); // returns a list containing [6, 2, 7, 3, 9]
hdr_strong
Inherited from:
ArrayList.subList
hdr_strong
Implementation of:
List.subList
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
List.toArray
_.toString(serializerFn)
- Converts the arrayList into a JSON String
@example
//arrayList contains [1,2,3,4]
console.log(arrayList.toString((x)=>(x.toString())));
//Output
//"[1,2,3,4]"
hdr_strong
Inherited from:
ArrayList.toString
hdr_strong
Implementation of:
Serializable.toString
_.trimToSize()
- Trims the capacity of this ArrayList instance to be the list's current size.
@example
//arrayList contains [1,2,3,4,5] and capacity is 10
arrayList.trimToSize(); //new capacity is 5
hdr_strong
Inherited from:
ArrayList.trimToSize
donut_large ImmutableCollection<E>
- A Collection whose properties / elements cannot be changed.
hdr_weak
Extended By:
ImmutableList
donut_large ImmutableList<E>
- A List whose properties / elements cannot be changed.
hdr_strong
Extends:
ImmutableCollection
play_circle_outline "ImmutableList" Methods
_.contains(item)
- Returns true if this list contains the specified element.
_.containsAll(items)
- Returns true if this list contains all of the elements in the specified array.
_.get(index)
- Read an item at the specified position in the list.
_.size()
- Returns the size of this list
donut_small Iterator<E>
- Used to iterate over Iterable objects
hdr_strong
Implements:
IterableIterator
new Iterator<E>(target)
new Iterator<E>(target,index)
play_circle_outline "Iterator" Methods
_.__@iterator()
- Return the iterator
_.forEachRemaining(action)
- Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
@example
//target contains [1,2,3,4], iterator pointer after 2
iterator.forEachRemaining(function(item, index) {
console.log(item*2);
});
// Output: 6 8
_.hasNext()
- Returns true if the iteration has more elements.
@example
//target contains [1,2,3,4] iterator pointer after 3.
if(iterator.hasNext()) console.log("Elements remaining");
//Ouput: Elements remaining
_.next()
- Returns the next element in the iteration.
@example
//target contains [1,25,83,48] iterator pointer after 1.
console.log((item = iterator.next());
//Output 25
_.remove()
- Removes from the underlying Iterable the last element returned by this iterator.
@example
//target contains [1,25,83,48] iterator pointer after 1.
iterator.next() //returns 25
iterator.remove(); //removes 25
// now target contains [1,83,48]
donut_large List<E>
- Sub interface of Collection. List has much more functionalities than a collection.
hdr_strong
Extends:
Collection
play_circle_outline "List" Methods
_.__@iterator()
hdr_strong
Inherited from:
Iterable.[Symbol.iterator]
_.add(item)
- Appends the specified element to the end of this list
_.add(item,index)
- Inserts the specified element at the specified position in this list
_.addAll(items)
- Appends all of the elements in the specified array to the end of this list
_.addAll(items,index)
- Inserts all of the elements in the specified array into this list at the specified position.
_.clear()
- Removes all of the elements from this collection
hdr_strong
Inherited from:
Collection.clear
_.contains(item)
- Returns true if this collection contains the specified element.
hdr_strong
Inherited from:
Collection.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
hdr_strong
Inherited from:
Collection.containsAll
_.equals(collection)
- Compares the specified object with this collection for equality.
hdr_strong
Inherited from:
Collection.equals
_.forEach(action)
- Performs an action for each item in this collection.
hdr_strong
Inherited from:
Collection.forEach
_.get(index)
- Read an item from the list
_.indexOf(item)
- Returns the position of first occurrence of the element.
_.isEmpty()
- Returns true if this collection contains no elements.
hdr_strong
Inherited from:
Collection.isEmpty
_.lastIndexOf(item)
- Returns the position of last occurrence of the element.
_.median()
- Returns the median of the list
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
hdr_strong
Inherited from:
Collection.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
hdr_strong
Inherited from:
Collection.removeAll
_.removeAt(index)
- Removes the element at the specified position in this list.
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
hdr_strong
Inherited from:
Collection.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
hdr_strong
Inherited from:
Collection.retainAll
_.reverse()
- Reverse the list
_.set(index,item)
- Replaces the element at the specified position in this list with the specified element
_.size()
- Returns the number of elements in this collection.
hdr_strong
Inherited from:
Collection.size
_.sort(compareFn)
- Sorts this list according to the compareFn
_.subList(fromIndex,toIndex)
- Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
_.toArray()
- Returns an array containing all of the elements in this collection
hdr_strong
Inherited from:
Collection.toArray
donut_large Map<K,V>
- An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
play_circle_outline "Map" Methods
_.clear()
- Removes all of the mappings from this map.
_.compute(key,remappingFn)
- Attempts to compute a mapping for the specified key and its current mapped value.
_.computeIfAbsent(key,remappingFn)
- If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map.
_.computeIfPresent(key,remappingFn)
- If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.
_.containsKey(key)
- Returns true if this map contains a mapping for the specified key.
_.containsValue(value)
- Returns true if this map maps one or more keys to the specified value.
_.entrySet()
- Returns a Set view of the mappings contained in this map.
_.equals(map)
- Compares the specified map with this map for equality.
_.forEach(action)
- Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
_.get(key)
- Returns the value to which the specified key is mapped. undefined if there is no mapping.
_.getOrDefault(key,defaultValue)
- Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key or if key is mapped to null.
_.isEmpty()
- Returns true if this map contains no key-value mappings.
_.keySet()
- Returns a Set view of the keys contained in this map.
_.put(key,value)
- Associates the specified value with the specified key in this map.Returns the old value associated with the key or undefined.
_.putAll(map)
- Copies all of the mappings from the specified map to this map.
_.putIfAbsent(key,value)
- If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns undefined, else returns the current value.
_.remove(key)
- Removes the mapping for a key from this map if it is present
_.removeIf(key,value)
- Removes the entry for the specified key only if it is currently mapped to the specified value.
_.replace(oldValue,newValue)
- Replace all entries with specified value with the new value. Returns true if map was changed.
_.replaceAll(remappingFn)
- Replaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception.
_.size()
- Returns the number of key-value mappings in this map.
_.values()
- Returns a List view of the values contained in this map.
donut_large MapEntry<K,V>
- Used to denote an entry in Map(readonly).
donut_large Matrix<E>
play_circle_outline "Matrix" Methods
_.equals(matrix)
- Check whether the specified matrix is equal to this matrix.
_.get(rowIndex,columnIndex)
- Read the item at the specified position in this matrix.
_.height()
- Returns the number of rows in this matrix.
_.put(rowIndex,columnIndex,item)
- Insert an item at the specified position in this matrix.
_.subMatrix(rows,cols)
- Returns the submatrix obtained after removing the specified rows and columns from this matrix.
_.transpose()
- Returns the transpose of this matrix.
_.width()
- Returns the number of columns in this matrix.
donut_large MatrixColumn<E>
- A single column of a matrix.
donut_large MatrixRow<E>
- A single row of a matrix.
donut_small NumberMatrix
- An Array Matrix with only number values. Matrix element has a default value of 0.
hdr_strong
Extends:
ArrayMatrix
hdr_weak
Extended By:
SquareMatrix
new NumberMatrix(height,width)
new NumberMatrix(height,width,defaultValue)
play_circle_outline "NumberMatrix" Methods
_.add(matrix)
- Add to each element in this matrix the corresponding elements in the specified matrix.
@example
// m1:
// [1 2]
// [2 3]
// m2:
// [3 2]
// [4 3]
m1.add(m2);
// [4 4]
// [6 6]
_.clone()
- Create a copy of the current object and return
@example
matrix.clone();
hdr_strong
Inherited from:
ArrayMatrix.clone
hdr_strong
Implementation of:
Cloneable.clone
_.col(index)
- Returns the column correponding to the specified index.
@example
m1.col(1); // [2,3]
_.equals(matrix)
- Check whether the specified matrix is equal to this matrix.
@example
// m1:
// [1 2]
// [2 3]
// m2:
// [1 2]
// [2 3]
m1.equals(m2); //returns true
hdr_strong
Inherited from:
ArrayMatrix.equals
hdr_strong
Implementation of:
Matrix.equals
_.get(rowIndex,columnIndex)
- Read the item at the specified position in this matrix.
@example
// [1 2 3]
// [2 3 4]
// [3 4 5]
matrix.get(1,1); //3
hdr_strong
Inherited from:
ArrayMatrix.get
hdr_strong
Implementation of:
Matrix.get
_.height()
- Returns the number of rows in this matrix.
@example
matrix.height(); //return 3
hdr_strong
Inherited from:
ArrayMatrix.height
hdr_strong
Implementation of:
Matrix.height
_.put(rowIndex,columnIndex,item)
- Insert an item at the specified position in this matrix.
@example
// [1 2 3]
// [2 3 4]
// [3 4 5]
matrix.put(0,1,5);
// [1 2 3]
// [5 3 4]
// [3 4 5]
hdr_strong
Inherited from:
ArrayMatrix.put
hdr_strong
Implementation of:
Matrix.put
_.row(index)
- Returns the row correponding to the specified index.
@example
m1.row(0); // [1,2]
_.scalarMultiply(scalar)
- Multiply each element in this matrix with the specified scalar.
@example
m1.multiply(2);
// [2 4]
// [4 6]
_.subMatrix(rows,cols)
- Returns the submatrix obtained after removing the specified rows and columns from this matrix.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.subMatrix([0],[1])
// [4 6]
// [7 9]
hdr_strong
Inherited from:
ArrayMatrix.subMatrix
hdr_strong
Implementation of:
Matrix.subMatrix
_.subtract(matrix)
- Subtract from each element in this matrix, the corresponding elements in the specified matrix.
@example
m1.subtract(m2);
// [-2 0]
// [-2 0]
_.toArray()
- Return a 2 dimensional array corresponding to the matrix.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.toArray(); //[[1,2,3],[4,5,6],[7,8,9]]
hdr_strong
Inherited from:
ArrayMatrix.toArray
_.transpose()
- Returns the transpose of this matrix.
@example
// [1 2 3]
// [4 5 6]
// [7 8 9]
matrix.transpose();
// [1 4 7]
// [2 5 8]
// [3 6 9]
hdr_strong
Inherited from:
ArrayMatrix.transpose
hdr_strong
Implementation of:
Matrix.transpose
_.width()
- Returns the number of columns in this matrix.
@example
matrix.width(); //return 3
hdr_strong
Inherited from:
ArrayMatrix.width
hdr_strong
Implementation of:
Matrix.width
_.allOnes(height,width)
- Returns an all-ones matrix of given order.
@example
let allOneMatrix = NumberMatrix.allOnes(2,3)
// [1 1 1]
// [1 1 1]
_.fromArray(array)
- Create a matrix from the specified two dimensional array.
@example
NumberMatrix.fromArray([[1,2],[3,4]]);
// [1 2]
// [3 4]
_.generate(height,width,generateFn)
- Generate a matrix based on the given order and generateFn function on the indices.
@example
let m = NumberMatrix.generate(3,3,(i,j)=>(i+j));
// [0 1 2]
// [1 2 3]
// [2 3 4]
_.multiply(a,b)
- Multiply two matrices and return the resultant matrix.
@example
// m1:
// [1 2 3]
// [2 3 4]
// m2:
// [1 1]
// [2 2]
// [3 3]
NumberMatrix.multiply(m1,m2)
// [14 14]
// [20 20]
_.zero(height,width)
- Returns a zero matrix of given order.
@example
let zeroMatrix = NumberMatrix.zero(2,3)
// [0 0 0]
// [0 0 0]
donut_small NumberMatrixColumn
- A single column of a NumberMatrix.
Is obtained by calling col() method of a NumberMatrix instance.
hdr_strong
Extends:
ArrayMatrixColumn
hdr_strong
Implements:
MatrixColumn
new NumberMatrixColumn(matrix,index)
swap_horiz "NumberMatrixColumn" Accessors
_.index
- Return the index of this colun in the matrix it belongs to.
_.matrix
- Return the matrix to which this column belong.
play_circle_outline "NumberMatrixColumn" Methods
_.add(col)
- Add to this column another column of the same matix.
@example
//nm:NumberMatrix.
let c1 = nm.col(0);
let c2 = nm.col(1);
c1.add(c2); // C1 -> C1 + C2
_.add(col,coeff)
- Add to this column a multiple of a column of the same matix.
@example
c1.add(c2, 3); // C1 -> C1 + 3C2
_.change(col)
- Change this matrix column with another column of same matrix.
@example
//am:ArrayMatrix
let c1 = am.col(0);
let c2 = am.col(1);
c1.change(c2); // corresponds to C1 -> C2
hdr_strong
Inherited from:
ArrayMatrixColumn.change
hdr_strong
Implementation of:
MatrixColumn.change
_.interchange(col)
- Interchange this column with another column of the same matrix.
@example
//am:ArrayMatrix
let c1 = am.col(0);
let c2 = am.col(1);
c1.interchange(c2); // corresponds to C1 <-> C2
hdr_strong
Inherited from:
ArrayMatrixColumn.interchange
hdr_strong
Implementation of:
MatrixColumn.interchange
_.multiply(scalar)
- Multiply all entries of a column by a non-zero scalar.
@example
//nm:NumberMatrix.
let c1 = nm.col(0);
c1.multiply(5); // C1 -> 5.C1
_.toArray()
- Return an array corresponding to this column.
@example
//am:ArrayMatrix
// [1 1 1]
// [0 1 1]
// [0 0 1]
am.col(1).toArray() // [1,1,0]
hdr_strong
Inherited from:
ArrayMatrixColumn.toArray
donut_small NumberMatrixRow
- A single row of a NumberMatrix.
Is obtained by calling row() method of a NumberMatrix instance.
hdr_strong
Extends:
ArrayMatrixRow
hdr_strong
Implements:
MatrixRow
new NumberMatrixRow(matrix,index)
swap_horiz "NumberMatrixRow" Accessors
_.index
- Return the index of this row in the matrix it belongs to.
_.matrix
- Return the matrix to which this row belong.
play_circle_outline "NumberMatrixRow" Methods
_.add(row)
- Add to this row another row of the same matix.
@example
//nm:NumberMatrix.
let r1 = nm.row(0);
let r2 = nm.row(1);
r1.add(r2); // R1 -> R1 + R2
_.add(row,coeff)
- Add to this row a multiple of a row of the same matix.
@example
//nm:NumberMatrix.
let r1 = nm.row(0);
let r2 = nm.row(1);
r1.add(r2, 3); // R1 -> R1 + 3R2
_.change(row)
- Change this matrix row with another row of same matrix.
@example
//am:ArrayMatrix
let r1 = am.row(0);
let r2 = am.row(1);
r1.change(r2); // corresponds to R1 -> R2
hdr_strong
Inherited from:
ArrayMatrixRow.change
hdr_strong
Implementation of:
MatrixRow.change
_.interchange(row)
- Interchange this row with another row of the same matrix.
@example
//am:ArrayMatrix
let r1 = am.row(0);
let r2 = am.row(1);
r1.interchange(r2); // corresponds to R1 <-> R2
hdr_strong
Inherited from:
ArrayMatrixRow.interchange
hdr_strong
Implementation of:
MatrixRow.interchange
_.multiply(scalar)
- Multiply all entries of a row by a non-zero scalar.
@example
//nm:NumberMatrix.
let r1 = nm.row(0);
r1.multiply(5); // R1 -> 5.R1
_.toArray()
- Return an array corresponding to this row.
@example
//am:ArrayMatrix
// [1 0 0]
// [0 1 0]
// [0 0 1]
am.row(1).toArray() // [0,1,0]
hdr_strong
Inherited from:
ArrayMatrixRow.toArray
donut_small PriorityQueue<E>
- An unbounded priority queue. The elements of the priority queue are ordered according to the compare function provided at queue construction time.
hdr_strong
Extends:
AbstractQueue
new PriorityQueue<E>(compareFn,...items)
play_circle_outline "PriorityQueue" Methods
_.__@iterator()
- Return the iterator
hdr_strong
Inherited from:
AbstractCollection.[Symbol.iterator]
hdr_strong
Implementation of:
Queue.__@iterator
_.add(item)
- Inserts the specified item into this priority queue.
@example
//queue containes [1,8,12] (compareFn designed for ascending order)
queue.add(6); //[1,6,8,12]
hdr_strong
Implementation of:
Queue.add
_.addAll(items)
- Inserts all items of an array into this priority queue.
@example
//queue containes [1,8,12] (compareFn designed for ascending order)
queue.addAll([6,10,15]); //[1,6,8,10,12,15]
hdr_strong
Implementation of:
Queue.addAll
_.clear()
- Removes all the elements
@example
//collection contains [1,2,3]
collection.clear();
//now collection contains []
hdr_strong
Inherited from:
AbstractCollection.clear
hdr_strong
Implementation of:
Queue.clear
_.comparator()
- Returns the compare function used to order the elements in this queue.
@example
queue.comparator(); //returns a function
_.contains(item)
- Returns true if this collection contains the specified element.
@example
//collection contains [1,2,3]
console.log(collection.contains(3));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.contains
hdr_strong
Implementation of:
Queue.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
@example
//collection contains [1,2,3]
console.log(collection.contains([1,2,4]));
//Output: false
hdr_strong
Inherited from:
AbstractCollection.containsAll
hdr_strong
Implementation of:
Queue.containsAll
_.element()
- Retrieves, but does not remove, the head of this queue
@example
//queue has elements [1,2,3,4]
console.log(queue.element());
//Output: 1
hdr_strong
Inherited from:
AbstractQueue.element
hdr_strong
Implementation of:
Queue.element
_.equals(collection)
- Compares the specified object with this collection for equality.
@example
//collection1 contains [1,2,3] and collection2 contains [1,2,3]
console.log(collection1.equals(collection2));
//Output: true
hdr_strong
Inherited from:
AbstractCollection.equals
hdr_strong
Implementation of:
Queue.equals
_.forEach(action)
- Performs an action for each item in this collection.
@example
//collection contains [1,2,3,4]
collection.forEach(function(item) {
console.log(item * 4);
});
//Output: 4 8 12 16
hdr_strong
Inherited from:
AbstractCollection.forEach
hdr_strong
Implementation of:
Queue.forEach
_.fromString(json,deserializerFn)
- Return the Object from the JSON string
@example
//json = "[1,2,3,4]"
queue = new PriorityQueue<number>((x,y)=>(x-y)).fromString(json,(x)=>(parseFloat(x)));
//queue contains [1,2,3,4]
hdr_strong
Implementation of:
Serializable.fromString
_.isEmpty()
- Returns true if this collection contains no elements.
@example
//collection contains [1,2,3]
console.log(collection.isEmpty());
//Output: false
hdr_strong
Inherited from:
AbstractCollection.isEmpty
hdr_strong
Implementation of:
Queue.isEmpty
_.iterator()
- Returns an iterator for the collection
@example
var iterator = collection.iterator(); //returns an Iterator for the collection
hdr_strong
Inherited from:
AbstractCollection.iterator
hdr_strong
Implementation of:
Queue.iterator
_.poll()
- Retrieves and removes the head of this queue.
@example
//queue has elements [1,2,3,4]
console.log(queue.element());
//Output: 1 and queue now has elements [2,3,4]
hdr_strong
Inherited from:
AbstractQueue.poll
hdr_strong
Implementation of:
Queue.poll
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
@example
//collection contains [1,2,3]
collection.remove(3);
//now collection contains [1,2]
hdr_strong
Inherited from:
AbstractCollection.remove
hdr_strong
Implementation of:
Queue.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.removeAll([1,3,5,7]);
//now collection contains [2,4]
hdr_strong
Inherited from:
AbstractCollection.removeAll
hdr_strong
Implementation of:
Queue.removeAll
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
@example
//collection contains [1,2,3,4,5,6,7,8,9]
collection.removeIf(function(x) {
return (x%2==0);
}); //removing even numbers
//now collection contains [1,3,5,7,9]
hdr_strong
Inherited from:
AbstractCollection.removeIf
hdr_strong
Implementation of:
Queue.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
@example
//collection contains [1,2,3,4]
collection.retainAll([1,3,5,7]);
//now collection contains [1,3]
hdr_strong
Inherited from:
AbstractCollection.retainAll
hdr_strong
Implementation of:
Queue.retainAll
_.size()
- Returns the number of elements in this collection.
@example
//collection contains [1,2,3,4]
console.log(collection.size());
//Output: 4
hdr_strong
Inherited from:
AbstractCollection.size
hdr_strong
Implementation of:
Queue.size
_.toArray()
- Returns an array containing all of the elements in this collection
@example
//collection contains [1,2,3,4]
console.log(collection.toArray());
//Output: [1,2,3,4]
hdr_strong
Inherited from:
AbstractCollection.toArray
hdr_strong
Implementation of:
Queue.toArray
_.toString(serializerFn)
- Converts the queue into a JSON String
@example
//queue contains [1,2,3,4]
console.log(queue.toString((x)=>(x.toString())));
//Output
//[1,2,3,4]
hdr_strong
Implementation of:
Serializable.toString
donut_large Queue<E>
hdr_strong
Extends:
Collection
play_circle_outline "Queue" Methods
_.__@iterator()
hdr_strong
Inherited from:
Iterable.[Symbol.iterator]
_.add(item)
_.addAll(items)
- Add all items of an array to collection
hdr_strong
Inherited from:
Collection.addAll
_.clear()
- Removes all of the elements from this collection
hdr_strong
Inherited from:
Collection.clear
_.contains(item)
- Returns true if this collection contains the specified element.
hdr_strong
Inherited from:
Collection.contains
_.containsAll(items)
- Returns true if this collection contains all of the elements in the specified array.
hdr_strong
Inherited from:
Collection.containsAll
_.element()
_.equals(collection)
- Compares the specified object with this collection for equality.
hdr_strong
Inherited from:
Collection.equals
_.forEach(action)
- Performs an action for each item in this collection.
hdr_strong
Inherited from:
Collection.forEach
_.isEmpty()
- Returns true if this collection contains no elements.
hdr_strong
Inherited from:
Collection.isEmpty
_.poll()
_.remove(item)
- Removes a single instance of the specified element from this collection, if it is present
hdr_strong
Inherited from:
Collection.remove
_.removeAll(items)
- Removes all of this collection's elements that are also contained in the specified array.
hdr_strong
Inherited from:
Collection.removeAll
_.removeIf(filterFn)
- Removes all of the elements of this collection that satisfy the given filter function.
hdr_strong
Inherited from:
Collection.removeIf
_.retainAll(items)
- Retains only the elements in this collection that are contained in the specified array.
hdr_strong
Inherited from:
Collection.retainAll
_.size()
- Returns the number of elements in this collection.
hdr_strong
Inherited from:
Collection.size
_.toArray()
- Returns an array containing all of the elements in this collection
hdr_strong
Inherited from:
Collection.toArray
donut_small Relation<X,Y>
- A binary Relation between two sets.
new Relation<X,Y>(domainSet,rangeSet,relationFn)
donut_small Rope
- A rope is a binary tree where each leaf node contains a short string.
Used to efficiently store and manipulate a very long string
hdr_strong
Extends:
AbstractBinaryTree
hdr_strong
Implements:
BinaryTree
new Rope()
new Rope(str)
new Rope(str,spacing)
play_circle_outline "Rope" Methods
_.balance()
- Balance the rope.
_.concat(rope)
- Concatenate the specified rope with this rope.
_.delete(str)
-
_.delete(i,j)
- Delete the substring starting at index i with a length j. Returns the deleted part as Rope.
hdr_strong
Implementation of:
BinaryTree.delete
_.get(index)
- Return the character at position specified by index.
_.get(index,node)
- Return the character at position specified by index, beginning from the specified node.
_.getRoot()
- Return the root node of this rope.
_.height(node)
- Returns the height of this binary tree.
@example
bt.height();// returns a number.
hdr_strong
Inherited from:
AbstractBinaryTree.height
hdr_strong
Implementation of:
BinaryTree.height
_.inorder(node)
- Returns the list of items obtained after inorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.inorder();
hdr_strong
Inherited from:
AbstractBinaryTree.inorder
hdr_strong
Implementation of:
BinaryTree.inorder
_.insert(str)
- Insert string at the end of this rope.
_.insert(str,index)
- Insert string at the specified position of this rope.
_.insert(rope,index)
- Insert a rope at the specified position of this rope.
hdr_strong
Implementation of:
BinaryTree.insert
_.insertNode(node)
- Insert the specified node at the end of this rope.
_.postorder(node)
- Returns the list of items obtained after postorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.postorder();
hdr_strong
Inherited from:
AbstractBinaryTree.postorder
hdr_strong
Implementation of:
BinaryTree.postorder
_.preorder(node)
- Returns the list of items obtained after preorder traversal of the tree starting from the specified node (default root).
@example
//bt:BinaryTree<number>
bt.preorder();
hdr_strong
Inherited from:
AbstractBinaryTree.preorder
hdr_strong
Implementation of:
BinaryTree.preorder
_.report(i,j)
- Returns the substring starting at index i with a length j.
_.report(i,j,node)
- Returns the substring starting at index i with a length j. Beginning at the specified node.
_.split(index)
- Split this rope at the given position. Returns the right child after splitting.
_.split(index,node)
_.toString()
- Convert the rope into a string.
_.fromNode(node)
- Create a new Rope from the RopeNode.
donut_small RopeNode
- Represents a node of Rope data structure.
hdr_strong
Extends:
BinaryTreeNode
new RopeNode()
new RopeNode(label)
new RopeNode(left)
new RopeNode(left,right)
donut_large Serializable
- Implementing this interface means that the class overrides Object's toString method to return the object's JSON String
donut_large Set<E>
- A collection that contains no duplicate elements
hdr_strong
Extends:
Collection
hdr_weak
Extended By:
SortedSet
play_circle_outline "Set" Methods
_.__@iterator()
hdr_strong
Inherited from:
Iterable.[Symbol.iterator]
_.add(item)
- Adds the specified element to this set if it is not already present
_.addAll(items)
- Adds all of the elements in the specified array to this set if they're not already present
_.clear()
- Removes all of the elements from this collection
hdr_strong
Inherited from:
Collection.clear
_.contains(item)