SortedList - acadet/ludivine GitHub Wiki
SortedList<A, B>
|> IListableCollection<A>
|> ISortableCollection<A>
|> ICollection<A>
Sorted list. Each operation keeps the list sorted. SortedList is double typed: A types elements, B types comparable value.
Example
class Person {
name : string;
age : number;
}
p1 = new Person();
p1.age = 34;
p2 = new Person();
p2.age = 17;
list = new SortedList<Person, number>(x => x.age);
list.add(p1);
list.add(p2);
// list = p2 | p1SortedList<A, B>(getter : Func<A, B>)Creates new ascending sorted list.
Parameters
getter Returns comparable value from any element of list
SortedList<A, B>(getter : Func<A, B>, ascending : boolean)Creates new sorted list with specified order.
Parameters
getter Returns comparable value from any element of list
ascending True if list has to be ascending, false otherwise
add(value : A) : voidInherited from IListableCollection.
average(getter : Func<A, number>) : numberInherited from ICollection.
exists(selector : Func<A, boolean>) : booleanInherited from ICollection.
find(selector : Func<A, boolean>) : AInherited from ICollection.
forEach(action : Action<A>) : voidInherited from ICollection.
getAt(index : number) : AInherited from IListableCollection.
getLength() : numberInherited from IListableCollection.
intersect(collection : ICollection<A>) : ICollection<A>Inherited from ICollection.
map(action : Func<A, A>) : ICollection<A>Inherited from ICollection.
max(getter : Func<A, number>) : AInherited from ICollection.
min(getter : Func<A, number>) : AInherited from ICollection.
orderBy<C>(getter : Func<A, C>) : ISortableCollection<A>Inherited from ISortableCollection.
orderByDesc<C>(getter : Func<A, C>) : ISortableCollection<A>Inherited from ISortableCollection.
remove(value : A) : voidInherited from IListableCollection.
removeAt(index : number) : voidInherited from IListableCollection.
removeIf(func : Func<A, boolean>) : voidInherited from IListableCollection.
reverse() : ISortableCollection<A>Inherited from ISortableCollection.
select(selector : Func<A, boolean>) : ICollection<A>Inherited from ICollection.
sum(getter : Func<A, number>) : numberInherited from ICollection.
toArray() : Array<A>Inherited from ICollection.
toDictionary<K, V>(keyGetter : Func<A, K>, valueGetter : Func<A, V>) : IDictionary<A, V>Inherited from ICollection.
toList() : IList<A>Inherited from ICollection.
union(collection : ICollection<A>) : ICollection<A>uniq() : ICollection<A>