Ah, Generics. That devious topic that emerges even in beginner texts. This subject trips up a lot of beginners because it’s tricky to understand and even trickier to explain. But we need to deal with it because without Generics, it’s difficult to work with Collections.
For the most part, Kotlin generics works the same way as Java generics; but they have some differences. In this chapter, we’ll look at how to work with generics and how similar (or different) Kotlin’s generics is from that of Java’s—also, don’t ...