There are situations when initializing the property can not be made in the declaration, its value is only known later.
An example of this is that in Android, references to views of a layout can only be obtained after the setContentView...
Below I'm logging into the Android Studio in JAVA a short phrase using conditional or ternary operator ( ?) in . See:
Log.wtf(GOT, (valirianSteel == 0 && glassOfDragon==0) ? "Run!" : "Run too!");
What would be equivalent to the...
In an example of loops in Kotlin documentation , we have some code with following excerpt:
loop@ for (i in 1..100) {
for (j in 1..100) {
if (...) break@loop
}
}
As I read in the documentation, it seems to be a Label and...
When we create a variable of type val , in the case of Java, only getter is created in relation to it. Different when a variable of type var is created, in which getter and setter is created. Here is an example:...
In Java I use switch in several situations, as in the example below :
public class SwitchDemo {
public static void main(String[] args) {
int month = 8;
String monthString;
switch (month) {
case...
Since converting my Android projects to Kotlin, in some research that I have been doing, they quoted several times by Anko Kotlin.
What is this guy from Anko? What it is? What is your goal?
I was thinking of an architecture that would work as follows. The user would have a series of parameters to populate and automatically generate code there click in a Buttom, be it in web or mobile would generate an apk application with t...
Kotlin allows returns for previously declared tags , including implicit tags.
Documentation example:
fun foo() {
ints.forEach {
if (it == 0) return@forEach
print(it)
}
}
In this spirit, I would like to make a lambda expressi...
Kotlin allows you to simplify the creation of what we call POJO in Java:
data class Person(val firstName: String, val lastName: String)
We get a class with the getter for all variables declared in the constructor as well as the methods...