By now, you should be fairly comfortable with using Kotlin on a basic level, the same way you might have used other object-oriented languages, like Java, before. You’ve seen how the concepts familiar to you from Java translate to Kotlin and how Kotlin often makes them more concise and readable.
In this chapter, you’ll see how Kotlin improves on one of the key elements of every program: declaring and calling functions. We’ll also look into the possibilities for adapting Java libraries to the Kotlin style through the use of extension functions, allowing you to gain the full benefits of Kotlin in mixed-language projects.
To make our discussion more useful and less abstract, we’ll focus on Kotlin collections, strings, and regular expressions as our problem domain. As an introduction, let’s look at how to create collections in Kotlin.