maxk
09/01/2017, 2:16 AMMessage
and subclasses are polymorphic datamaxk
09/01/2017, 2:17 AMzhuxun2
09/01/2017, 4:34 AMtechie01
09/04/2017, 6:38 AMgjesse
09/04/2017, 11:40 PM>>> fun Int.toHex() = this.toString(16)
>>> 16.toHex();
10
efemoney
09/05/2017, 7:15 AMfun Context.dpToPx(dp: Int) = ...
vs fun <T: Context> T.dpToPx(dp: Int) = ...
elect
09/05/2017, 6:28 PMinline fun <reified T>swizzles(swizzles: Swizzles) {
when (T) {
is Vec4b ->
voddan
09/05/2017, 6:32 PMwhen(T) { Vec4b ->
mike_shysh
09/06/2017, 3:04 PMfmcauley
09/06/2017, 8:52 PMwaylonbrown
09/06/2017, 9:50 PMelect
09/07/2017, 1:20 PMMAX
on a generic enum to represent the size?
this: val <E> Enum<E>.Companion.MAX get() = enumValues().size
, complains:
Type arguments for outer class are redundant when nested class is referenced
dreamreal
09/07/2017, 3:03 PMtrevjones
09/07/2017, 3:15 PMrizwan
09/07/2017, 3:23 PMtechie01
09/08/2017, 12:50 PMkarelpeeters
09/10/2017, 6:54 PMbenleggiero
09/10/2017, 6:56 PMval numberOfDoorsIndex = args.indexOf("--numberOfDoors")
val numberOfDoors: Int
if (numberOfDoorsIndex > 0 && args.size > numberOfDoorsIndex) {
val userSetNumberOfDoorsString = args[numberOfDoorsIndex]
try {
numberOfDoors = max(3, abs(userSetNumberOfDoorsString.toInt()))
}
catch (ex: NumberFormatException) {
numberOfDoors = 3 // error here
}
}
error:
Error:(22, 13) Kotlin: Val cannot be reassigned
Obviously it isn't going to be; if the NumberFormatException
is thrown, it was never assigned in the first place!karelpeeters
09/10/2017, 6:59 PMwaylonbrown
09/11/2017, 10:33 PMclass MyClass(context : Context) {
var context = context.applicationContext
then whenever I use context
and command click on it, the IDE takes me to the one referenced in the constructor instead of the field. Is that incorrect and the constructor's context reference isn't held onto?Regan Russell
09/11/2017, 10:35 PMelect
09/12/2017, 9:54 AMinfix
with Enum<*>
?baob
09/12/2017, 10:57 AMtechie01
09/12/2017, 11:59 AMnil2l
09/12/2017, 1:21 PMziad
09/12/2017, 4:17 PManstaendig
09/12/2017, 4:18 PMbamdmux
09/12/2017, 4:37 PMbamdmux
09/12/2017, 4:38 PMkarelpeeters
09/12/2017, 4:41 PMout
and in
are pretty good names, they match their use cases.karelpeeters
09/12/2017, 4:41 PMout
and in
are pretty good names, they match their use cases.ziad
09/12/2017, 4:41 PM