4 ms·
> built-in optional typing Typing is not optional, everything in Kotlin is typed. What the language has is type inference. The following lines have the exact
by sorokod 4y ago
> built-in optional typing
Typing is not optional, everything in Kotlin is typed. What the language has is type inference. The following lines have the exactly same types:
val teens = people.filter { it.age < 20 }.map { it.name }
val teens: List<String> = people.filter { p: Person -> p.age < 20 }.map { p: Person -> p.name }
- kaba0 4y agoJust for comparison’s sake, java is not significantly more verbose. final var teens = people.stream().filter(p -> p.age < 20).map(People::name).toList()
- LinXitoW 4y agoKeep in mind, you can use Kotlin in any JDK8 project and instantly get all those features. What you're proposing requires upgrading to a new JDK.