natpryce
06/22/2017, 1:22 PMnatpryce
06/22/2017, 1:23 PMmg6maciej
06/23/2017, 4:02 PMsomeArray.toUnmodifiableList()
after you add such extension in your codebase :)miha-x64
06/25/2017, 12:39 PMtoList()▾
miha-x64
06/25/2017, 12:39 PMMutableList
or mutate it from Java.louiscad
06/25/2017, 12:52 PMmenegatti
06/26/2017, 9:35 AMpavlospt
06/26/2017, 9:35 AMdimsuz
06/27/2017, 11:20 AMList
in an "immutable" fashion? It would be ok to place it in the end. Something like
listOf(1,2,3,5).replace(2, 8) // => [1,3,5,8] (or ideally [1,8,3,5])
dimsuz
06/27/2017, 11:20 AMmenegatti
06/27/2017, 11:22 AMlistOf(1,2,3,4).map { if (it == 2) 8 else it}
dimsuz
06/27/2017, 11:23 AMthomasnield
06/27/2017, 7:28 PMnkiesel
06/28/2017, 5:53 AMlistOf(true, null, false, true).filterNotNull().map { !it }
work but listOf(true, null, false, true).mapNotNull { !it }
complains about Boolean?
Compiler should be smart enough to understand the lambda values are Boolean
, no?enleur
06/28/2017, 6:18 AMmapNotNull { !it }
the argument here is Boolean?
so you have to check null explicitlydmitry.petrov
06/28/2017, 6:50 AMCompiler should be smart enough to understand the lambda values areNo. Lambda in, no?Boolean
listOf(true, null, false, true).mapNotNull { !it }
takes list elements (which are Boolean?
).
Meaning of mapNotNull
is not "skip null elements in the original container", but "skip null elements in the resulting container".damian
06/28/2017, 1:39 PMlistOf(true, null, false, true).mapNotNull { it?.not() }
kirillrakhman
06/28/2017, 5:38 PMkirillrakhman
06/28/2017, 5:39 PM.toList().dropLast(1).forEach {}
seems so wastefulorangy
orangy
kirillrakhman
06/28/2017, 6:01 PMkirillrakhman
06/28/2017, 6:01 PMkirillrakhman
06/28/2017, 6:06 PMbuildSequence
andrewoma
06/29/2017, 12:24 AMPeekingIterator
then was surprised to find it's a Guava thing and not standardpavlospt
06/29/2017, 10:43 AMfoo?.let { ... } else { ... }
? One could say that why do this when you can check it with an if(...) { ... } else { ... }
, but on the other hand the first seems prettier in most case and makes more sense. Anyone has any insights on this?menegatti
06/29/2017, 10:44 AMfoo?.let { ... } ?: ...
menegatti
06/29/2017, 10:44 AMuhe
06/29/2017, 12:01 PM?.let { ... } ?: ...
to avoid if else
is a smelluhe
06/29/2017, 12:02 PMlet
may return null