amanda.hinchman-dominguez
02/14/2018, 2:34 AMtrent
02/14/2018, 2:42 AMwhen
. Is it intentional?
For example, I cannot do this, even when Android Studio suggests me to:
val onDone: () -> Unit = when (side) {
LEFT -> {
refreshLeftText.set(refreshText)
{refreshLeftText.set("")}
}
RIGHT -> {
refreshRightText.set(refreshText)
{refreshRightText.set("")}
}
}
So I have to do this:
val onDone: () -> Unit
when (side) {
LEFT -> {
refreshLeftText.set(refreshText)
onDone = {refreshLeftText.set("")}
}
RIGHT -> {
refreshRightText.set(refreshText)
onDone = {refreshRightText.set("")}
}
}
I’m interested in making a contribution to fix this if you like. (if you guys help me!)Olekss
02/14/2018, 9:27 AMgildor
02/14/2018, 9:28 AMOlekss
02/14/2018, 9:30 AMaidanvii
02/14/2018, 10:33 AMkotlinOptions {
allWarningsAsErrors = true
}
aidanvii
02/14/2018, 10:33 AMJimmy Alvarez
02/14/2018, 11:20 AMJimmy Alvarez
02/14/2018, 11:20 AMdh44t
02/14/2018, 11:22 AMsindrenm
02/14/2018, 1:29 PMsetOf(1, 2, 3).map { it * 0 } // # => List(0, 0, 0)
Is this intentional? It sounds counter-intuitive that the collection type changes when calling map
from a Set
.sindrenm
02/14/2018, 1:30 PMSet(0)
back, not a List(0, 0, 0)
.menegatti
02/14/2018, 1:32 PMmap
always returns a List
marstran
02/14/2018, 1:32 PMmap
is an extension function on Iterable<T>
which always returns a List
.sindrenm
02/14/2018, 1:33 PMsindrenm
02/14/2018, 1:33 PMkarelpeeters
02/14/2018, 1:33 PMspand
02/14/2018, 1:33 PMkevinmost
02/14/2018, 1:34 PMLinkedHashSet
would preserve order toobennofs
02/14/2018, 1:34 PMspand
02/14/2018, 1:34 PMmarstran
02/14/2018, 1:35 PMmap
function is that the resulting collection has to have the same number of elements.karelpeeters
02/14/2018, 1:36 PMmapTo(mutableSetOf()) { ... }
robstoll
02/14/2018, 1:36 PMsetOf(1, 2, 3).asSequence().map { it * 0 }.toSet()
(in case you shouldn't know)sindrenm
02/14/2018, 1:42 PMsindrenm
02/14/2018, 1:43 PMmenegatti
02/14/2018, 1:54 PMinterface <in T> TaskListener {
fun onTaskComplete(results: Map<Int, List<T>>)
}
T
from being erased at runtime, as opposed to the star projectionT
is safe to be used as the type you passedEfe
02/14/2018, 1:58 PMkarelpeeters
02/14/2018, 2:01 PMwhich will preventWhat? Don't generics always get erased?from being erased at runtime, as opposed to the star projectionT