June 2018
Intermediate to advanced
310 pages
6h 32m
English
Hold on a second, how do square brackets keep working when we extended a map? Aren't they some kind of magic?
Well, actually no. No magic there. As you may have guessed by the title of this section, Kotlin supports operator overloading. Operator overloading means that the same operator acts differently, depending on the type of arguments it receives.
If you've ever worked with Java, you're familiar with operator overloading already. Think of how the plus operator works. Let take a look at the example given here:
System.out.println(1 + 1); // 2System.out.println("1" + "1") // 11
Based on whether two arguments are either strings or integers, the + sign acts differently.
But, in the Java world, this is something that ...
Read now
Unlock full access