bostonmacosx
08/10/2019, 1:43 AMbostonmacosx
08/10/2019, 4:08 AMIfvwm
08/10/2019, 1:55 PMJoaquim Ley
08/10/2019, 4:30 PMnyxcode
08/10/2019, 6:44 PMv79
08/11/2019, 6:59 AMforEach
, forEachIndex
, File.walk()
just syntactic sugar that I can use instead of (for x in y)
or should I be much for careful when using them? I've discovered that forEach
cannot be mocked with a library like mockk and that's playing havoc with my testing.Iaroslav Postovalov
08/11/2019, 9:35 AMString[]
in signature Kotlin recommends to have it as Array<out String>
. It is literally useless because String
is final
in Java.william
08/11/2019, 11:26 PMfangzhzh
08/12/2019, 3:42 AMdG
08/12/2019, 9:00 AMpublic static <T extends Enum<T>> T valueOf(Class<T> enumType, String name)
of Java.lang.Enum
not have an equivalent in Kotlin? If not, why not?Kavin
08/12/2019, 11:57 AMMarko Mitic
08/12/2019, 2:46 PMlist
is MutableList<Bucket>
Slackbot
08/12/2019, 3:40 PMSaiedmomen
08/13/2019, 5:54 AMrcd27
08/13/2019, 5:56 AMval x: Observable<Optional<String>> = ...
david-wg2
08/13/2019, 8:30 AMif (pin?.length != 36) throw UnauthorizedResponse()
// pin is smart cast here
if (pin?.length !in (8..36)) throw UnauthorizedResponse()
// pin is not smart cast here
aaverin
08/13/2019, 9:35 AMinterface Parent {
val a: String
val b: String
}
data class Person1(
override val a: String = "Person1 a",
override val b: String = "Person1 b"
): Parent
data class Person2(
override val b: String = "Person2 b",
override val a: String = "Person2 a"
): Parent
fun main() {
val person1 = Person1()
val person2 = Person2()
person1.let {
val (a, b) = person1
println("Destructuing person1, a is ${a}, b is ${b}")
}
person2.let {
val (a, b) = person2
println("Destructuing person2, a is ${a}, b is ${b}")
}
}
Results in
Destructuing person1, a is Person1 a, b is Person1 b
Destructuing person2, a is Person2 b, b is Person2 a
https://pl.kotl.in/sUDuggWbxJoffrey
08/13/2019, 2:34 PMJakub
08/13/2019, 2:47 PMjunit
& spek
.
We would like to migrate from Spek 2
framework to pure junit4
in our project. In our case that’s a ton of tests. Have you seen any converter that does that?bbaldino
08/13/2019, 7:59 PMassociateBy
which would support a mapping that was one to many? i.e. translate a List<Foo>
where Foo
is, say, data class Foo(val valueOne: Int, val valueTwo: String)
to a Map<Int, List<String>>
?Kapil Godhwani
08/13/2019, 10:32 PMjkbbwr
08/14/2019, 1:04 AMhkokocin
08/14/2019, 7:33 AMAndreas Du Rietz
08/14/2019, 7:40 AMcoder82
08/14/2019, 8:26 AMLastExceed
08/14/2019, 9:56 AMimport MyClass as SomeType
the same as
import MyClass
typealias SomeType = MyClass
?Joshlemer
08/14/2019, 2:14 PMjava.util.LinkedHashMap<Int,Int>
somehow implements kotlin.collections.Map<Int,Int>
? Is there scala-style implicit conversion / wrapping going on?
val lhm: kotlin.collections.Map<Int, Int> = java.util.LinkedHashMap()
ryn1x
08/14/2019, 6:10 PMSeri
08/14/2019, 6:39 PMabstract class State
with some helper functions, can I have them return the child type, without it getting generalized to just “anything that inherits from `State`“?Nezteb
08/14/2019, 8:57 PMNezteb
08/14/2019, 8:57 PMjosh
08/14/2019, 9:00 PMNezteb
08/14/2019, 9:02 PMPablichjenkov
08/14/2019, 9:15 PMfire and forget
kind of paradigm, normally Coroutines are more like fire and control
philosophy. Structured Concurrency as first class citizen.nfrankel
08/14/2019, 9:15 PM