-
Notifications
You must be signed in to change notification settings - Fork 1
SortedList
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 | p1
SortedList<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) : void
Inherited from IListableCollection.
average(getter : Func<A, number>) : number
Inherited from ICollection.
exists(selector : Func<A, boolean>) : boolean
Inherited from ICollection.
find(selector : Func<A, boolean>) : A
Inherited from ICollection.
forEach(action : Action<A>) : void
Inherited from ICollection.
getAt(index : number) : A
Inherited from IListableCollection.
getLength() : number
Inherited 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>) : A
Inherited from ICollection.
min(getter : Func<A, number>) : A
Inherited 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) : void
Inherited from IListableCollection.
removeAt(index : number) : void
Inherited from IListableCollection.
removeIf(func : Func<A, boolean>) : void
Inherited from IListableCollection.
reverse() : ISortableCollection<A>
Inherited from ISortableCollection.
select(selector : Func<A, boolean>) : ICollection<A>
Inherited from ICollection.
sum(getter : Func<A, number>) : number
Inherited 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>