ICollection - acadet/ludivine GitHub Wiki
Base interface for collections which provides generic operations. T
types content.
Some operations return new instance of original caller. For instance, calling select()
on a Queue will return a new Queue.
average(getter : Func<T, number>) : number
Computes average value from element using provided getter.
Parameters
getter Returns value to compute for any element
exists(selector : Func<T, boolean>) : boolean
Tests if there is an element matching provided condition.
Parameters
selector Condition to match
find(selector : Func<T, boolean>) : T
Finds first element matching condition. Default result is null
.
Parameters
selector Condition to match
forEach(action : Action<T>) : void
Applies provided action to each element of collection. Mind order of collection is preserved.
Parameters
action Application
intersect(collection : ICollection<T>) : ICollection<T>
Computes intersection of two collections.
Parameters
collection Data source
map(action : Func<T, T>) : ICollection<T>
Applies operation to each element and returns edited collection.
Parameters
action Map operation
max(getter : Func<T, number>) : T
Computes maximum from elements using provided getter.
Parameters
getter Returns value to use for any element
min(getter : Func<T, number>) : T
Computes minimum from elements using provided getter.
Parameters
getter Returns value to use for any element
select(selector : Func<T, boolean>) : ICollection<T>
Applies a filter on collection.
Parameters
selector Returns true if element must be kept
sum(getter : Func<T, number>) : number
Sums values from elements using provided getter.
Parameters
getter Returns value to sum for any element
toArray() : Array<T>
Reproduces collection as an array.
toDictionary<K, V>(keyGetter : Func<T, K>, valueGetter : Func<T, V>) : IDictionary<K, V>
Reproduces collection as a dictionary.
Parameters
keyGetter Returns key from source element
valueGetter Returns value from source element
toList() : IList<T>
Reproduces collection as a list.
union(collection : ICollection<T>) : ICollection<T>
Gathers two collections. Duplicates are removed.
Parameters
collection Data source
uniq() : ICollection<T>
Removes duplicates from collection.