The .( Operator, explained


I searched around the web and inside the Kotlin Documentations but had a hard time trying to understand what the simple dot after a class is supposed to achieve.

For example in this snippet, we see List<String>.() and it works fine. But without the .() the compiler is left wondering what I am trying to achieve.

    val isEmptyStringList: List<String>.() -> Boolean = List<String>::isEmpty

By the nature of this operator being just a “dot” it is very hard trying to find resources on it be it from Google or specialised search engines like symbolhound.

And if you think I should’ve found those resources by myself, please point me to how one can find such things.



Thank you!


Here’s a post that explains the dot operator:

If you get confused, check the date the post was published :wink:


Funny enough I got to this article while trying to find the real meaning behind the .( it didn’t help me at all but made me chuckle.