Hasan
02/21/2019, 3:36 PMHasan
02/21/2019, 3:39 PMDavid Cuesta
02/21/2019, 3:58 PMamadeu01
02/21/2019, 6:35 PMDanilo Herrera
02/21/2019, 6:52 PMteasp00n
02/22/2019, 2:43 AMcamdenorrb
02/22/2019, 2:56 AMelect
02/22/2019, 9:09 AMAnimesh
02/22/2019, 12:23 PMUraniam9
02/22/2019, 2:20 PMitasyurt
02/22/2019, 3:10 PMRob
02/22/2019, 5:15 PMabstract class A()
class B(): A()
class C(): A()
fun foo(b: B)
fun foo(c: C)
If I have something like this, a base class with subclasses and overloaded functions, what is the "best" way to call it IF they are stored in a variable of type A?
class Something(val member: A)
val v = Something(B())
foo(v.member) // How to get this to call the right foo
Francesco megna
02/22/2019, 7:57 PMbootstraponline
02/23/2019, 1:37 AMHauke Radtki
02/23/2019, 10:33 AMigor.wojda
02/23/2019, 4:45 PMmaxDigits
function be simplified? I want to find what is the longest digit in the list and return length of that digit. Method works but can it be done using kotlin stdlib functions without using digit length (digitCount
) twice ?
val Int.digitCount get() = this.toString().length
fun maxDigits(list: List<Int>): Int = list.maxBy { it.digitCount }?.digitCount ?: 0
FalseHonesty
02/23/2019, 4:58 PMmuralimohan962
02/24/2019, 4:24 AMSlackbot
02/24/2019, 6:24 AMPHondogo
02/24/2019, 9:58 AMjkbbwr
02/24/2019, 1:16 PMjkbbwr
02/24/2019, 1:39 PMSystemkern
02/24/2019, 3:58 PMSam
02/24/2019, 4:54 PMbjonnh
02/24/2019, 6:31 PMAndrew Gazelka
02/24/2019, 6:33 PMKProperty
before getValue(...)
? I want certain updates to occur before the variable is first accessed, and I need the property name to do this.camdenorrb
02/24/2019, 7:38 PMRômero Ricardo
02/25/2019, 11:59 AMJan
02/25/2019, 12:13 PMthana
02/25/2019, 1:34 PMnull
? (all examples i can find implie the other way round)thana
02/25/2019, 1:34 PMnull
? (all examples i can find implie the other way round)LeoColman
02/25/2019, 1:36 PMthana
02/25/2019, 1:36 PMLeoColman
02/25/2019, 1:36 PMthana
02/25/2019, 1:37 PMstreetsofboston
02/25/2019, 1:40 PMLeoColman
02/25/2019, 1:43 PMthana
02/25/2019, 1:49 PMfalse
it will return a non-null value - always.
i knew this smeels before, but then i saw a colleague using it, and he had to use ?.
all over the place and i though "hey this is kotlin! it has a cool feature that might solve this problem" and didn't realise it would be much easier to simply split the method into twoLeoColman
02/25/2019, 1:56 PMthana
02/25/2019, 1:59 PM