jw
02/04/2017, 9:47 PMjw
02/04/2017, 9:48 PMsreich
02/05/2017, 1:16 AMjw
02/05/2017, 2:47 AMsreich
02/05/2017, 10:53 AMsreich
02/05/2017, 10:54 AMlouiscad
02/05/2017, 12:49 PMkirillrakhman
02/05/2017, 1:55 PMkirillrakhman
02/05/2017, 1:56 PMkirillrakhman
02/05/2017, 1:58 PMsreich
02/06/2017, 12:16 AMsreich
02/06/2017, 12:16 AMsreich
02/06/2017, 12:16 AMdimsuz
02/06/2017, 1:26 PMYou can also use explicit comparison of Boolean:
if (flag1 && (flag2 || someFlag == true))
More clean and native then elvis or extension functionWell, this would produce a different behavior compared to my examples. In my case
someFlag.orTrue()
would resolve to true
when someFlag == null
, but in your example someFlag == true
would resolve to false
if this flag is null. I.e. .orTrue()
and .orFalse()
allow me to finetune behavior of null boolean values. This is rarely needed, but there are cases when this helps... Otherwise your suggestion in certainly nicer 🙂koral
02/07/2017, 6:00 PMkotlin.text.all
doc says Returns true if all characters match the given predicate.
however true
is returned also always for empty textskoral
02/07/2017, 6:00 PM"".all { it.isDigit() }
true
koral
02/07/2017, 6:01 PMorangy
koral
02/07/2017, 6:03 PMorangy
toIntOrNull
if you can use 1.1-beta and that’s what you’re actually trying to dokoral
02/07/2017, 6:37 PM.all
behavior matches my case, just want to confirmpcarrier
02/09/2017, 5:01 AMjava.lang.Long
, but there doesn't seem to be an equivalent to java.lang.Long.BYTES
in kotlin.Long
. am I missing something?pcarrier
02/09/2017, 5:19 AMkirillrakhman
02/09/2017, 10:25 AMpcarrier
02/10/2017, 2:03 AMkirillrakhman
02/10/2017, 8:19 AMkirillrakhman
02/10/2017, 8:20 AMelizarov
02/10/2017, 9:13 AMint
in C is platform-dependent (in practice ranges from 16 bits to 64 bits). However, in Kotlin Int
is always 32 bits.pcarrier
02/10/2017, 9:27 AMstdint.h
for modern C, golang has https://golang.org/ref/spec#Numeric_types and rust has https://doc.rust-lang.org/book/primitive-types.html#numeric-typespcarrier
02/10/2017, 9:28 AM