mplatvoet
12/25/2015, 8:19 PMmplatvoet
12/25/2015, 8:19 PMorangy
orangy
mplatvoet
12/25/2015, 8:21 PMmplatvoet
12/25/2015, 8:23 PMorangy
mplatvoet
12/25/2015, 8:24 PMmplatvoet
12/25/2015, 8:26 PMorangy
orangy
cedric
12/25/2015, 8:27 PMmplatvoet
12/25/2015, 8:27 PMcedric
12/25/2015, 8:28 PMapatrida
12/26/2015, 2:37 AMapatrida
12/26/2015, 2:38 AMmplatvoet
12/26/2015, 7:19 AMto
(create
?). Just like toInt()
and toDouble()
, above could be toNoNulls
.apatrida
12/26/2015, 10:08 PMEugenio
12/27/2015, 10:28 AMorangy
items.filterToList { …}.mapToList {… }
like this?mplatvoet
12/28/2015, 7:49 AMfilter
and map
etc always do lazy evaluations, so no matter whether something is an Iterable
or a Sequence
, it will be consistent behaviour. The behaviour is not dependent on the type of the receiver.
That does leave your concern about accidental reevaluations open as commonly seen with naive C# Linq programming. E.g. where some DB query is fired over and over again because someone forgot to create a snapshot of the results. However, I think a consistent API will make it easier to cope (educate) with such issues.cbruegg
12/28/2015, 8:33 AMmplatvoet
12/28/2015, 8:46 AMmap
function:
//lazy
fun <T, R> Sequence<T>.map(transform: (T) -> R): Sequence<R>
//lazy (for Lists etc…)
fun <T, R> Iterable<T>.map(transform: (T) -> R): Iterable<R>
//snapshot
fun <T, R> Iterable<T>.mapToList(transform: (T) -> R): List<R>
natpryce
12/28/2015, 10:49 AMnatpryce
12/28/2015, 10:50 AMmplatvoet
12/28/2015, 10:50 AMmplatvoet
12/28/2015, 10:51 AMnatpryce
12/28/2015, 11:28 AMmplatvoet
12/28/2015, 1:00 PMapatrida
12/29/2015, 4:17 AMList
of some unknown type needs to become a List
of some known type) … and with indication you know the results.