package com.howtodoinjava.demo; import java.util.HashMap; import java.util.Map; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.core.Ordered; import org.s...
and it is mainly used to hold the references for the kotlin classes. Using these classes, the reflection concept will play a wide role, and using the type parameter of the specified classes like kClass, it can be referred to by using the references so that kclass is referred to as...
there is so much more to the story. Before diving into more complex concepts and defining how to make your own cryptocurrency, you should first know the answer to the question, “what is a cryptocurrency?”
Check out the source code to have a try:https://github.com/tony-xlh/Compose-Multiplatform-QR-Code-ScannerIN THIS BLOG POST PrerequisitesCreate a New Compose Multiplatform ProjectDeclare Camera PermissionAdd DependenciesAndroidiOSCreate a Scanner ComponentDefine the ComponentAndroid ImplementationiOS ...
"arun kumar" to Customers("arun kumar", 16)) map2.forEach{ println(it) } } Output: In the above example, we used kotlin codes but return type as Unit on the output console screen. Here we used some enums, classes and classes like collections. Using enums we can declare the values...
In this code, we use filter_map() to filter the people vector while simultaneously collecting the names of those who are 30 or older. The closure checks the age and returns Some(name) for those who meet the condition and None for those who don’t. The result is a new vector of names...
Kotlin 2. Minimize Activity Leaks Activity leaks or memory leaks, in general, are extremely dangerous. How does it happen? If we keep a reference to an unused Activity in our code, we keep all of the Activity’s layout as well as its views. As a consequence, there are a lot of pixel...
Compared to Java, you can notice the lack of semicolons, the lack of brackets on empty class (you can add some if you need to declare beans via @Bean annotation) and the use of runApplication top level function. runApplication<BlogApplication>(*args) is Kotlin idiomatic alternative to Spr...
5. Time to add dependencies! a) In your buildSrc, create a new src/main/kotlin directory. This is used to store all your Kotlin source code for this module — including how we will declare dependencies.6. Finally, inside the src/main/kotlin directory, create a new Kotlin object class ...
Now add the following method to the structure:static func badgesEarned(runs: [Run]) -> [BadgeStatus] { return Badge.allBadges.map { badge in var earned: Run? var silver: Run? var gold: Run? var best: Run? for run in runs where run.distance > badge.distance { if earned == nil ...