Explore tweets tagged as #KotlinTips
#KotlinTips. Null-safety is the bread and butter of Kotlin! Use the null-safe call to avoid if-null checks:
4
40
306
If you need an array of primitives, like an array of ints, use a specific type like 'IntArray' rather then 'Array<Int>' . #KotlinTips
10
48
385
Learn Kotlin Collection Functions: associateBy. Check the example. Learn and Share ๐. #AndroidDev #Kotlin #KotlinTips #Developer #Android
1
19
82
#KotlinTips. We prefer using default arguments instead of overloading. Default arguments in Kotlin remove nearly all use cases for method and constructor overloading.
4
34
220
Kotlin Collection Functions: all. Check the example. Learn and Share . #AndroidDev #Kotlin #KotlinTips #Android #Developer
0
9
81
In Foo::bar, bar can also be an extension to Foo. Like in Char::isLetterOrDigit. #KotlinTips
1
28
139
Kotlin filtering function - partition(): filters a collection by a predicate and keeps the elements that don't match it in a separate list. Share it if you learned something new. #Kotlin #KotlinTips #AndroidDev #Android
3
36
140
You can implement an interface to your companion object or extend it from a class. #Kotlin #KotlinTips #Android #AndroidDev
5
17
124
To create a map from an iterable or a sequence, use โassociateโ function and specify how to build a map entry from each element. If an element becomes a key, use 'associateWith'. If it becomes a value, use 'associateBy' instead. #KotlinTips
1
34
229
Kotlin - Idiomatic way to remove duplicate strings from an array. - distinct().- toSet().- toMutableSet().- toHashSet(). Share it if you learned something new. #Kotlin #KotlinTips #AndroidDev
1
27
104
If you want to reference enum constants directly in the code, not as just import them. #KotlinTips
1
24
127
Inspired by @JorgeCastilloPr tweet I decided to present & describe various ways of exposing LiveData from ViewModel to a View (usually Fragment). #AndroidDev #Kotlin #KotlinTips #LiveData
10
39
121
Kotlin Best Practices: Constants in Kotlin. Check the example. Learn and Share. #Kotlin #KotlinTips #AndroidDev #Developer
5
11
74
Kotlin Collection Functions are useful, take advantage of it while coding. Use them based on your use-cases. Check the example. Share it if you learned something new. #AndroidDev #Kotlin #KotlinTips
1
15
56
Learn Kotlin Collection Functions: chunked. Check the example. Learn and Share ๐. #AndroidDev #Kotlin #KotlinTips #Android #Developer
1
6
43