#kotlintip 搜尋結果
Kotlin generic types; <T> = type and object definition should be the same class <in T> = type definition should be same or subclass of object definition <out T> = object definition should be the same or subclass of type definition #Kotlin #KotlinTip #Android #AndroidDev
Make your unit tests much more readable with Kotlin infix functions. #Kotlin #KotlinTip #Android #AndroidDev
#KotlinTip: When using two classes with the same name from different packages in the same file, use import alias to refer to these classes by their aliases. #AndroidDev
Being more readable with the failure message, but use it carefully `trimIndent()` #KotlinTip #Kotlin
#KotlinTip #Kotlin Nested class v. Inner class Nested class - Use it for modularity, clean and readable code Inner class - Use it when the child wants to hold the reference of its parent class
#KotlinTip💡 - If you're using multiple try-catch statements then code might be confusing🙆. - With kotlin Higher order function you can minimize it😉. - You'll just need to put your code which might throw exception under that block🔥. - See image below👇. #Kotlin #AndroidDev
Kotlin Tip: Avoid NumberFormatException when converting a String to an Int using toIntOrNull() instead of toInt(). #Kotlin #KotlinTip #AndroidDev #100DaysOfCode
Change coroutine context with flowOn operation. It does not effect downStream. #Kotlin #KotlinTip #KotlinCoroutine #Flow
Posted this a few days ago as a #KotlinTip only to realize that everyone has mixed opinions about which one they prefer. The question now is: Which one would you use and why Solution 2? 👀 #AndroidDev
💡#KotlinTip - Use `runCatching()` instead of using normal try-catch if you want any data which throw an exception. - It provides `getOrNull()`, `getOrDefault()`, `getOrElse()` functions. #Kotlin #KotlinDev #AndroidDev
#KotlinTip 💡 Safe casting To avoid exceptions while casting unknown types, you can use the "safe" cast operator `as?` that returns `null` on failure. Know more about it: kotlinlang.org/docs/typecasts… #Kotlin
#KotlinTip💡 - buildString{} is an inline function in #Kotlin that provides StringBuilder as a lambda receiver scope (this) and let us build String based on conditions at runtime!🏃 - Finally, it returns a String🚀 - See this example 👇 #androiddev #idiomatic #simple #coding
Kotlin Tip: When using two classes with the same name from different packages, use import alias to refer to these classes by their aliases. #AndroidDev #Kotlin #KotlinTip
#KotlinTip 💡 - takeIf-takeUnless Scope functions - `takeIf{}` returns this object if it matches the predicate. Otherwise, it returns null. - `takeUnless{}` returns the object if it doesn't match the predicate. Otherwise, it returns null. #kotlin #androiddev #programming
🚨 What is 𝘊𝘰𝘮𝘱𝘢𝘯𝘪𝘰𝘯 𝘖𝘣𝘫𝘦𝘤𝘵? #kotlin #kotlintip The creators of Kotlin did not want to use Java's 𝘴𝘵𝘢𝘵𝘪𝘤 concept directly, but in order to maintain compatibility with Java, they provided a construct called 𝘤𝘰𝘮𝘱𝘢𝘯𝘪𝘰𝘯 𝘰𝘣𝘫𝘦𝘤𝘵. (short thread🧵👇)
Little trick in #Kotlin that really made my day when I discovered it: ✅ A cleaner way to update key-values in a map: #androiddev #kotlintip
🚀 #KotlinTip: Choose your Coroutine Dispatcher wisely! Default: CPU-intensive work IO: Network or disk operations Main: UI updates Optimize your code with the right dispatcher! 💡 #Kotlin #AndroidDev
Kotlin Tip: When using two classes with the same name from different packages, use import alias to refer to these classes by their aliases. #AndroidDev #Kotlin #KotlinTip
Kotlin Tip: Use the joinToString function to join elements of a collection with a separator, instead of using the StringBuilder class #AndroidDev #Kotlin #KotlinTip
Kotlin Tip: When using two classes with the same name from different packages, use import alias to refer to these classes by their aliases. #AndroidDev #Kotlin #KotlinTip #100DaysOfCode
Kotlin Tip: Avoid NumberFormatException when converting a String to an Int using toIntOrNull() instead of toInt(). #Kotlin #KotlinTip #AndroidDev #100DaysOfCode
Measuring time taken by a function to execute with measureTimedValue youtu.be/j_LEcry7Pms #Kotlin #kotlintip
youtube.com
YouTube
Calculate Your Code Performance | Kotlin Tips 2023
💡Did you know that there's a method named `windowed` which returns a list of snapshots sliding along with the collection? 😮 Thanks to @sebi_io. Got this from his AoC repo 😅 ➡️ Docs: kotlinlang.org/api/latest/jvm… #KotlinTip
Change coroutine context with flowOn operation. It does not effect downStream. #Kotlin #KotlinTip #KotlinCoroutine #Flow
With Junit5, ParameterizedTest annotation is a great way to test your function multiple times with different parameters. For more information: junit.org/junit5/docs/cu… #Kotlin #KotlinTip #Android #AndroidDev #Junit
Make your unit tests much more readable with Kotlin infix functions. #Kotlin #KotlinTip #Android #AndroidDev
Kotlin generic types; <T> = type and object definition should be the same class <in T> = type definition should be same or subclass of object definition <out T> = object definition should be the same or subclass of type definition #Kotlin #KotlinTip #Android #AndroidDev
#KotlinTip💡 - buildString{} is an inline function in #Kotlin that provides StringBuilder as a lambda receiver scope (this) and let us build String based on conditions at runtime!🏃 - Finally, it returns a String🚀 - See this example 👇 #androiddev #idiomatic #simple #coding
#KotlinTip #Kotlin Nested class v. Inner class Nested class - Use it for modularity, clean and readable code Inner class - Use it when the child wants to hold the reference of its parent class
Make your unit tests much more readable with Kotlin infix functions. #Kotlin #KotlinTip #Android #AndroidDev
Kotlin generic types; <T> = type and object definition should be the same class <in T> = type definition should be same or subclass of object definition <out T> = object definition should be the same or subclass of type definition #Kotlin #KotlinTip #Android #AndroidDev
Being more readable with the failure message, but use it carefully `trimIndent()` #KotlinTip #Kotlin
#KotlinTip: When using two classes with the same name from different packages in the same file, use import alias to refer to these classes by their aliases. #AndroidDev
#KotlinTip #Kotlin Nested class v. Inner class Nested class - Use it for modularity, clean and readable code Inner class - Use it when the child wants to hold the reference of its parent class
#KotlinTip💡 - If you're using multiple try-catch statements then code might be confusing🙆. - With kotlin Higher order function you can minimize it😉. - You'll just need to put your code which might throw exception under that block🔥. - See image below👇. #Kotlin #AndroidDev
Kotlin Tip: Avoid NumberFormatException when converting a String to an Int using toIntOrNull() instead of toInt(). #Kotlin #KotlinTip #AndroidDev #100DaysOfCode
Change coroutine context with flowOn operation. It does not effect downStream. #Kotlin #KotlinTip #KotlinCoroutine #Flow
#KotlinTip 💡 Safe casting To avoid exceptions while casting unknown types, you can use the "safe" cast operator `as?` that returns `null` on failure. Know more about it: kotlinlang.org/docs/typecasts… #Kotlin
Posted this a few days ago as a #KotlinTip only to realize that everyone has mixed opinions about which one they prefer. The question now is: Which one would you use and why Solution 2? 👀 #AndroidDev
📣 Kotlin Tip 📣 Deshazte del NullPointerException. En Kotlin por defecto todo objeto no es nulo, si deseas que soporte nulos, debes declararlo explícitamente, una vez hagas eso y quieres acceder a ese objeto, Kotlin te mandará un error para la validación. #KotlinTip #AndroidDev
With Junit5, ParameterizedTest annotation is a great way to test your function multiple times with different parameters. For more information: junit.org/junit5/docs/cu… #Kotlin #KotlinTip #Android #AndroidDev #Junit
💡#KotlinTip - Use `runCatching()` instead of using normal try-catch if you want any data which throw an exception. - It provides `getOrNull()`, `getOrDefault()`, `getOrElse()` functions. #Kotlin #KotlinDev #AndroidDev
Kotlin Tip: When using two classes with the same name from different packages, use import alias to refer to these classes by their aliases. #AndroidDev #Kotlin #KotlinTip
#KotlinTip💡 - buildString{} is an inline function in #Kotlin that provides StringBuilder as a lambda receiver scope (this) and let us build String based on conditions at runtime!🏃 - Finally, it returns a String🚀 - See this example 👇 #androiddev #idiomatic #simple #coding
Something went wrong.
Something went wrong.
United States Trends
- 1. Brian Cole 6,238 posts
- 2. #Kodezi N/A
- 3. Walter Payton 7,505 posts
- 4. Price 267K posts
- 5. Chronos 1,079 posts
- 6. Merry Christmas 68.7K posts
- 7. The FBI 109K posts
- 8. #25SilverPagesofSoobin 31K posts
- 9. #NationalCookieDay N/A
- 10. #WPMOYChallenge 12K posts
- 11. Good Thursday 38.9K posts
- 12. #thursdayvibes 2,886 posts
- 13. $META 12.3K posts
- 14. yihe N/A
- 15. GLOWING FAYE AT RED SEA FILM25 64.5K posts
- 16. Dealerships 1,841 posts
- 17. The Blaze 5,668 posts
- 18. Tong 17.1K posts
- 19. Somali 249K posts
- 20. Metaverse 8,213 posts