AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Kotlin range to9/1/2023 ![]() ![]() ![]() Reading the element using the index operator is translated into a call of get operator method. In Kotlin , the index operator is one more convention. Meanwhile, it’s time to see how this works. You guy’s, already know that in Kotlin , you can access the elements in a Map similarly to how you access Arrays in java–via square brackets: val value = map So, enough of this theory let’s see the example first of how we can use these conventions in our application. Similarly, the same technique applies on get, set, in, and on a rangeTo convention. Because of that Kotlin refers to this technique as Kotlin Conventions. What is Kotlin Conventions:įor Example, if your class defines a special method name plus, then, by convention you can use the + operator on the instance of this class. The set of interfaces implemented by a class is fixed, and Kotlin can’t modify an existing class so that it would implement additional interfaces. We all know, Kotlin use the principle of a convention, instead of relying on types of Java does, because this allows developers to adapt existing Java classes to the requirement of Kotlin language features. ![]()
0 Comments
Read More
Leave a Reply. |