September 2019
Intermediate to advanced
462 pages
11h 3m
English
Calling code written in Java from within Kotlin .kt files and .kts scripts is straightforward for most part. Kotlin naturally integrates with Java, and we can use properties and methods without thinking twice—it almost always just works.
To see this in action, and learn ways to work around occasional glitches you may run into, let’s write a Java class that we will then use from Kotlin.
| | package com.agiledeveloper; |
| | |
| | import java.util.List; |
| | import static java.util.stream.Collectors.toList; |
| | |
| | public class JavaClass { |
| | public int getZero() { return 0; } |
| | |
| | public List<String> convertToUpper(List<String> names) { |
| | |
Read now
Unlock full access