I'm planning to prepare a presentation for a KUG m...
# announcements
p
I'm planning to prepare a presentation for a KUG meeting on this topic: "_10 surprises when coming from Java to Kotlin_". Please share in this thread things that in your opinion would be worth mentioning in the presentation :) I have my thoughts, but reaching to the community because maybe I forgot about something important (started with Kotlin 4 years ago, might have forgotten something).
šŸ‘ 2
As an example: in Java we first write variable type and then it's name, and in Kotlin - the opposite. Such examples will be accompanied in the presentation with explanations why Kotlin designers might have chosen a given patch.
b
Daisy-chaining function calls is is not limited to collections (Streams in Java). Functions like let(), apply() and also() act as glue
šŸ™ 1
Type inference is very neat but not be mindfull with inferred function return types. (Still figuring out when to (not) rely on them)
šŸ™ 1
Singletons are native to the Kotlin langauge (
object
)
šŸ™ 1
Assign multiple values in 1 statement:
val (a, b) = regex.matchEntire(ā€œsome stringā€).destructured
.
šŸ™ 1
Pair
and
Triple
are included in the kotlin std lib
šŸ™ 1
c
Foo(bar) { lambda }
- the lambda is an argument to Foo even though it's outside the brackets! Very confusing
šŸ™ 1
a
Yes
b
in Kotlin
if
is an expression while in Java it is just a statement
šŸ™ 1
šŸ’Æ 1
a
The setters and getters change to just the variable name itself (i.e. setAge() and getAge(), just become age=<>)
šŸ™ 1
b
Just as I was getting accustomed to using
infix
function
or
I discovered that it behaves like Java's
|
and not
||
!
šŸ‘ 1
d
There is no
static
šŸ‘ 1
b
Extending upon @darkmoon_uk: a Kotlin nested class is like a Java static nested class. While a Kotlin
inner
nested classes is like a Java non-static nested classes.
šŸ‘ 1
@Piotr Krzemiński would you mind sharing your presentation? (Assuming it is in English). Thanks
p
yep, it will be published during Tricity Kotlin User Group meeting on September 16th, I'll share the recording here
b
šŸ‘