<@U5XDSK718> <@U5UU34LPK> Thanks. I tried already ...
# getting-started
h
@nil2l @karelpeeters Thanks. I tried already a
listOf
solution and it didn't work because of inheritance. Well, I guess then the simple
is
solution is directly readable and I stick to this. Thanks for your efforts 🙂
s
the
when
solution was at least a little bit more concise
h
Ahh, damn. I don't use Slack that often and I haven't seen the direct reply. Thanks for throwing it into my face
s
haha, no worries dude
n
But this one works well with inheritance. No?
Copy code
val v = HashSet<String>()
listOf(String::class, Set::class).any { it.isInstance(v) }
k
But is that really better?
n
It’s shorter. Looks not good because of
::class
. And I don’t know if it will require kotlin-reflection as dependency. As for problem I think it must be solved via common interface, and not if-is’s.