The document demonstrates the use of Kotlin collection functions like filter, map, flatMap, groupBy, sortedBy etc on sample data models of Category and Product. It shows how to search for one item, filter, map, group collections and sort data. Advanced techniques include filtering, mapping price with VAT, flattening category subcategories, grouping by category, sorting by price etc.
Kotlin is a cross-platform, statically typed, general-purpose programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of Kotlin's standard library depends on the Java Class Library, but type inference allows its syntax to be more concise.
The event will be led by Zoltan Domahidi (Senior Kotlin Software Engineer at Magyar Telekom).
Kotlin is a cross-platform, statically typed, general-purpose programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of Kotlin's standard library depends on the Java Class Library, but type inference allows its syntax to be more concise.
The event will be led by Zoltan Domahidi (Senior Kotlin Software Engineer at Magyar Telekom).
This contains all the slides used in Silicon Valley Code Camp presentation on Sunday Oct 4, 10:45 session on "Amazing new features in JavaScript". At the end ut also includes the last year presentation covering ES 5
Kotlin provides a lot of features out of the box even though those are not supported by JVM. Have you ever wondered how Kotlin does it? If yes, then this presentation is for you.
Kotlin compiler tweaks our code in such a way that, JVM can execute it. this deck goes through lots of Kotlin features and explains how it looks at runtime for JVM compatibility. Of course we are not going to look into bytecode, instead we will look into the decompiled version of the bytecode generated by Kotlin compiler.
NOTE: This was presented at DevFest Kolkata 2019.
Many projects use at least some of them - the Jakarta Commons libraries. Small reusable libraries simplifying the day-to-day work of thousands of java programmers. But over time the jakarta commons project has grown and the number of components makes it harder and harder to keep track. This session will try to give an overview of the components available and how the Jakarta Commons community is organized.
No dark magic - Byte code engineering in the real worldtcurdt
ften byte code engineering is perceived as "black magic" and considered too low level. This session will not bore you with all the details of the JVM specification but provide you with a practical overview of how this byte code "swizzling" can be used in the real world instead. Several projects have sucessfully leveraged this technique to achieve some amazing things (e.g. AOP). This session will go through some of these examples and try to outline the differences between the two major libraries (BCEL and ASM). Maybe your next project can then benefit from some of this "magic".
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
This contains all the slides used in Silicon Valley Code Camp presentation on Sunday Oct 4, 10:45 session on "Amazing new features in JavaScript". At the end ut also includes the last year presentation covering ES 5
Kotlin provides a lot of features out of the box even though those are not supported by JVM. Have you ever wondered how Kotlin does it? If yes, then this presentation is for you.
Kotlin compiler tweaks our code in such a way that, JVM can execute it. this deck goes through lots of Kotlin features and explains how it looks at runtime for JVM compatibility. Of course we are not going to look into bytecode, instead we will look into the decompiled version of the bytecode generated by Kotlin compiler.
NOTE: This was presented at DevFest Kolkata 2019.
Many projects use at least some of them - the Jakarta Commons libraries. Small reusable libraries simplifying the day-to-day work of thousands of java programmers. But over time the jakarta commons project has grown and the number of components makes it harder and harder to keep track. This session will try to give an overview of the components available and how the Jakarta Commons community is organized.
No dark magic - Byte code engineering in the real worldtcurdt
ften byte code engineering is perceived as "black magic" and considered too low level. This session will not bore you with all the details of the JVM specification but provide you with a practical overview of how this byte code "swizzling" can be used in the real world instead. Several projects have sucessfully leveraged this technique to achieve some amazing things (e.g. AOP). This session will go through some of these examples and try to outline the differences between the two major libraries (BCEL and ASM). Maybe your next project can then benefit from some of this "magic".
From Java to Kotlin beyond alt+shift+cmd+k - Kotlin Community Conf MilanFabio Collini
Kotlin is a first-class language for Android development since Google I/O 2017. And it’s here to stay!
Thanks to Android Studio it’s really easy to introduce Kotlin in an existing project, the configuration is trivial and then we can convert Java classes to Kotlin using a Alt+Shift+Cmd+K. But the new syntax is the just beginning, using Kotlin we can improve our code making it more readable and simpler to write.
In this talk we’ll see how to use some Kotlin features (for example data classes, collections, coroutines and delegates) to simplify Android development comparing the code with the equivalent “modern” Java code. It’s not fair to compare Kotlin code with plain Java 6 code so the Java examples will use lambdas and some external libraries like RxJava and AutoValue.
Ubiratan Soares - Software Engineer da Stone, fala sobre Kotlin : Advanced Tricks no Kotlin Community Summit 2018.
https://eventos.imasters.com.br/kotlinsummit/
Saiba mais em
Kotlin is something more than just tool that help you remove boilerplate from you code. It brings much more than just lamdas and handy syntax to your Java or Android project
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018Codemotion
Kotlin is a programming language developed by JetBrains that targets multiple platforms including the JVM, JavaScript, and native binaries. A year ago it has been adopted as an officially supported language for Android development. Kotlin offers clean and concise syntax, interoperability, both object-oriented and functional code constructs, and a lot of other cool features with little or no overhead. Let's find out together why developers love this language and how it helps them to be productive and have fun!
Scala is becoming the language of choice for many development teams. This talk highlights how Scala excels in the world of multi-core processing and explores how it compares to Java 8.
Video Presentation: http://youtu.be/8vxTowBXJSg
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
3. Apply, Also, With
fun initTextView(context: Context) {
val tvJAV = TextView(context)
tvJAV.setText(R.string.app_name)
tvJAV.setTextColor(ContextCompat.getColor(context, R.color.colorPrimary))
tvJAV.setOnClickListener {
Toast.makeText(context, "Hello JAV", Toast.LENGTH_SHORT).show()
}
}
Java Style
4. Apply, Also, With
fun initTextView(context: Context) {
val tvJAV = TextView(context).apply {
//this in this block is tvJAV scope
setText(R.string.app_name)
setTextColor(ContextCompat.getColor(context, R.color.colorPrimary))
setOnClickListener {
Toast.makeText(context, "Hello JAV", Toast.LENGTH_SHORT).show()
}
}
}
Apply
5. Apply, Also, With
Also
fun initTextView(context: Context) {
val tvJAV = TextView(context).also {
//it or can assign new name
it.setText(R.string.app_name)
it.setTextColor(ContextCompat.getColor(context, R.color.colorPrimary))
it.setOnClickListener {
Toast.makeText(context, "Hello JAV", Toast.LENGTH_SHORT).show()
}
}
}
6. Apply, Also, With
With
fun initTextView(context: Context) {
val textViewText = with(textView) {
setText(R.string.app_name)
setTextColor(ContextCompat.getColor(context, R.color.colorPrimary))
setOnClickListener{
Toast.makeText(context, "Hello JAV", Toast.LENGTH_SHORT).show()
}
// Last statement is return value
text
}
// textViewText = "Miracle of stdLib"
}
7. Let, Run
fun callApi(callback: ((String) -> Unit)? = null) {
val resultString: String? = "" //TODO: Call API and get String result
if (resultString != null && callback != null) {
callback.invoke(resultString)
}
}
Java Style
fun callApi(callback: ((String) -> Unit)? = null) {
val resultString: String? = ""//TODO: Call API and get String result
resultString?.let { success?.invoke(it) }
// or
resultString?.run { success?.invoke(this) }
}
Kotlin Style
8. Let, Run
fun sumPair() {
val pair: Pair<Int, Int>? = Pair(3, 5)
var sum = if (pair != null) pair.first + pair.second else 0
}
Java Style
fun sumPair() {
val pair: Pair<Int, Int>? = Pair(3, 5)
val sumRun = pair?.run { first + second } ?: 0
// or
val sumLet = pair?.let { it.first + it.second } ?: 0
}
Kotlin Style
11. Lazy
class FakeFragment : Fragment() {
// This approach can not run cuz ...
val badPreference = context.getSharedPreferences(...)
lateinit var lateInitPreference: SharedPreferences
val lazyPreference: SharedPreferences by lazy { context.getSharedPreferences(...) }
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
lateInitPreference = context.getSharedPreferences(...)
lateInitPreference.getString("LATEINIT_PREFERENCE", ":|")
lazyPreference.getString("LAZY_PREFERENCE", ":)")
}
}
12. Observable
class HelloObservable {
var name by Delegates.observable("time0") { _, old, new ->
println("New $new, Old $old")
}
fun run() {
name = "time1" // New time1, Old time0
name = "time2" // New time2, Old time1
name = "time3" // New time3, Old time2
name = "time5" // New time5, Old time3
name = "time6" // New time6, Old time5
}
}
13. Vetoable
class HelloVetoable {
var age by Delegates.vetoable(0) { _, old, new ->
println("New $new, Old $old")
new < 10
}
fun run() {
age = 1 // age = 1
age = 2 // age = 2
age = 10 // age = 2
age = 1000 // age = 2
}
}
15. Type
val list = listOf(1, 2, 3) // [1, 2, 3]
val set = setOf("Ant", "Bat", "Cat", "Ant", "Bat") // [Ant, Bat, Cat]
val map = mapOf("A" to 1, "B" to 2) // {"A":1, "B":2}
val range = 1..5 // [1, 2, 3, 4, 5]
val rangeChar = 'A'..'C' // ['A', 'B', 'C']
Immutable
val list = mutableListOf("A", "B", "C", "A", "B") // [A, B, C, A, B]
list.add("D") // [A, B, C, A, B, D]
list.add(0, "Z") // [Z, A, B, C, A, B, D]
list.removeAt(1) // [Z, B, C, A, B, D]
val set = mutableSetOf("A", "B", "C", "A", "B") // [A, B, C]
val map = mutableMapOf("A" to 1, "B" to 2) // {"A":1, "B":2}
map.remove("C") // {"A":1, "B":2}
Mutable
16. Extension Function
val list = listOf(1, 2, 3)
list.all { it > 0 } // true
list.any { it < 0 } // false
list.none { it > 5 } // false
list.joinToString("Kotlin") // 1Kotlin2Kotlin3
list.sum() // 6
set.sumBy { it.length } // 9
map.minBy { it.value } // {"A":1}
3 in range // true
range.sum() // 15
// Loop
for (i in 0..list.size - 1) {
list[i]
}
list.forEach { item -> }
list.forEachIndexed { index, item -> }
// Convert Type
list.toSet()
set.toMutableList()
map.toList()
range.toList()
17. Extension Function (Operator/Infix)
val list1 = listOf(1, 2, 3) // [1, 2, 3]
val list2 = listOf(3, 4) // [3, 4]
val listPlus = list1 + list2 // [1, 2, 3, 3, 4]
val listMinus = list1 - list2 // [1, 2]
val listContain = 1 in list1 // true
val listUnion = list1 union list2 // [1, 2, 3, 4]
val listIntersect = list1 intersect list2 // [3]
val listSubtract = list1 subtract list2 // [1, 2]
val listZip = list1 zip list2 // [(1, 3), (2, 4)]
Operator Infix
18. Data Model
data class Category(val id: String,
val name: String,
val subCategoryList: List<Category> = listOf())
data class Product(val id: String,
val name: String,
val description: String,
val price: Double,
val category: Category)