orangy
dalexander
06/09/2017, 6:12 PMwitoldsz
06/11/2017, 10:39 PMjasonlow
06/12/2017, 2:12 AMColor("red")
does not work because enum types cannot be instantiated
.
And Color.valueof("red")
throws me an illegal argument exception
sk0g
06/12/2017, 12:34 PMRuckus
06/12/2017, 3:03 PMenum class People(value: Int) {
man(1),
baby(2),
woman(3);
companion object {
fun byValue(value: Int) = values().firstOrNull { it.value == value }
}
}
val people = People.byValue(3)
if (people != null) {
print("converted successfully => $people")
} else {
print("null value -> No Match")
}
tulio
06/12/2017, 4:22 PMcedric
06/12/2017, 4:33 PMif
cedric
06/13/2017, 4:14 PMResult
is not a monad, it lacks a few things for that.igor.wojda
06/13/2017, 11:44 PMconst
modifier) ?kingvhit
06/14/2017, 2:45 AMimport kotlinx.android.synthetic.main.activity_main.*
Or any shortcut do it by your hand ?alvico
06/14/2017, 8:39 AMgildor
06/14/2017, 9:36 AMfirst
and get nonnull resultangloha
06/14/2017, 4:52 PMdarger
06/14/2017, 7:32 PMakperkins1
06/14/2017, 8:10 PMwitoldsz
06/14/2017, 9:58 PMDecompile to Java
, Choose sources
. Should I download sources, unpack, point to Idea or the sources should be already somewhere? I am building project using Gradle, no cmd-line tools or other stuff installed.punitjajo
06/15/2017, 4:15 AMelect
06/15/2017, 10:31 AMfun findWindowSettings(name:String): IniData? {
val id = hash(name, 0)
return g.settings.firstOrNull { it.id == id }
}
as fun findWindowSettings(name:String) = g.settings.firstOrNull { it.id == hash(name, 0) }
will be the hash()
result cached or executed each time?duncanconroy
06/15/2017, 2:16 PMishwerdas
06/15/2017, 3:21 PMmmaillot
06/15/2017, 4:02 PMchuck
06/15/2017, 4:33 PMFor example, there are no implicit widening conversions for numbers ...Why not? https://kotlinlang.org/docs/reference/basic-types.html https://kotlinlang.org/docs/reference/basic-types.html#explicit-conversions
daveroberts
06/15/2017, 5:20 PMbryan
06/16/2017, 5:40 AMcase VALIDATE_PAIRING_KEY
?evkaky
06/16/2017, 8:09 AMthecipster
06/16/2017, 10:54 AMjava.io.File
variable is null or not readable. In Java this vould be
if (myFile == null || !myFile.canRead()) {
// error!
}
which works always because of short-circuit evaluation.
IntelliJ translates the above code to:
if (simDesc == null || !simDesc!!.canRead()) {
// error!
}
which is a bit ugly IMHO.
Any idea on making it more idiomatic?voddan
06/16/2017, 11:40 AMif
inside the when
?
is String -> if("HELLO".equals(obj.toUpperCase()))) println("Greeting")
ktw
06/16/2017, 1:21 PMperryprog
06/16/2017, 3:35 PMJun 16, 2017 11:34:03 AM org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines
INFO: Discovered TestEngines with IDs: [spek]
Exception in thread "main" java.lang.AbstractMethodError: Method org/jetbrains/spek/engine/Scope$Group.isTest()Z is abstract
at org.jetbrains.spek.engine.Scope$Group.isTest(Scope.kt)
at org.junit.platform.engine.TestDescriptor.hasTests(TestDescriptor.java:160)
at org.junit.platform.launcher.core.Root.lambda$static$0(Root.java:33)
at org.junit.platform.engine.TestDescriptor.accept(TestDescriptor.java:179)
at org.junit.platform.engine.TestDescriptor.lambda$accept$0(TestDescriptor.java:181)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.junit.platform.engine.TestDescriptor.accept(TestDescriptor.java:181)
at org.junit.platform.launcher.core.Root.lambda$acceptInAllTestEngines$2(Root.java:85)
at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608)
at org.junit.platform.launcher.core.Root.acceptInAllTestEngines(Root.java:85)
at org.junit.platform.launcher.core.Root.prune(Root.java:77)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
at org.jetbrains.spek.tooling.runner.junit.JUnitPlatformSpekRunner.run(JUnitPlatformSpekRunner.kt:107)
at org.jetbrains.spek.tooling.MainKt.main(Main.kt:58)