Questions tagged as 'kotlin'

1
answer

Is it possible to compile an app using Java and Kotlin together?

Can I be part of the code in Java and elsewhere with Kotlin? Can anyone tell me?     
asked by 22.03.2018 / 23:03
1
answer

What is lazy instantiation?

I saw here in the Wakim answer that code snippet: data class Person(val firstName: String, val lastName: String) { val fullName: String by lazy { "$firstName $lastName" } } What is this lazy instantiation ?     
asked by 12.08.2017 / 00:40
1
answer

What is the purpose of the data class?

In Kotlin you can create a class as follows: data class Dragon(private val name: String, val glass: Int) What is the main goal of data class in Kotlin? When should we use?     
asked by 11.08.2017 / 19:37
1
answer

How to get a random number in Kotlin?

How can I get a random number between two values? As ruby does with rand(0..n)     
asked by 26.01.2018 / 19:48
1
answer

What is the difference between Kotlin data class and Scala case class?

In Scala we have case classes , for example: case class Pessoa(nome: String, sobrenome: String) and in Kotlin we have data classes : data class Pessoa( val nome: String, val sobrenome: String ) What's the difference between...
asked by 10.07.2016 / 13:36
3
answers

How to create a static method using Kotlin?

In JAVA when we want to create a static method, we use static . See: public static String getDragonGlass(){ return String.valueOf("All the dragon glasses."); } And in Kotlin , what better way to represent a static method?     
asked by 08.08.2017 / 15:27
1
answer

What is the purpose of internal lateinit?

I converted to Kotlin a simple Fragment with any button. In the alternation, it basically looks like this: Java private Button btn; Kotlin internal lateinit var btn: Button What is the goal of internal lateinit ?...
asked by 09.08.2017 / 17:26
1
answer

What is the difference between Type-safe and Null-safe?

I'm writing an article about Kotlin, and I came across these guys if anyone can help me. What is the difference between Type-safe and Null-safe?     
asked by 24.10.2017 / 19:30
2
answers

Java conversion to Kotlin

One of the qualities mentioned in the Kotlin language is the creation of clean code, that is, code that is pleasant to read and can accomplish its purpose without curling. From what I've seen, Android Studio contains a translation for Kotlin,...
asked by 01.08.2017 / 20:59
2
answers

How to read a file with Kotlin?

I have a .txt file with some information I would like to read to a string through Kotlin. I am a beginner in the language and would like to know how to read a file with Kotlin.     
asked by 08.08.2017 / 16:12