Skip to Content
Kotlin in Action
book

Kotlin in Action

by Svetlana Isakova, Dmitry Jemerov
February 2017
Intermediate to advanced content levelIntermediate to advanced
360 pages
11h 55m
English
Manning Publications
Content preview from Kotlin in Action

Chapter 9. Generics

This chapter covers

  • Declaring generic functions and classes
  • Type erasure and reified type parameters
  • Declaration-site and use-site variance

You’ve already seen a few code examples that use generics in this book. The basic concepts of declaring and using generic classes and functions in Kotlin are similar to Java, so the earlier examples should have been clear without a detailed explanation. In this chapter, we’ll return to some of the examples and look at them in more detail.

We’ll then go deeper into the topic of generics and explore new concepts introduced in Kotlin, such as reified type parameters and declaration-site variance. These concepts may be novel to you, but don’t worry; the chapter covers them thoroughly. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kotlin in Action, Second Edition

Kotlin in Action, Second Edition

Roman Elizarov, Svetlana Isakova, Sebastian Aigner
Java to Kotlin

Java to Kotlin

Duncan McGregor, Nat Pryce
Head First Kotlin

Head First Kotlin

Dawn Griffiths, David Griffiths

Publisher Resources

ISBN: 9781617293290Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link