JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Success stories
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Subtyping and generics: why List “lifts”, but MutableList does not

    Kotlin SELF
    36 level,0 lecture
    We break down how subtyping works for generic types in Kotlin: why List<Expense> can be safely used as List<Transaction>, but MutableList<Expense> cannot be lifted to MutableList<Transaction>. With examples, we show invariance of containers ( Box<T>), covariance of read-only collections, compiler errors, and practical API design techniques (accept List if you don’t need to mutate), plus intuition via function types (Transaction) -> String.
    Open
  • Declaration-site variance: out and in in your generic types

    Kotlin SELF
    36 level,1 lecture
    We break down declaration-site variance in Kotlin: how to declare covariant producer types via out and contravariant consumer types via in, why the compiler forbids unsafe operations (for example, a var with a type parameter), and how this relates to familiar types like List, Comparable, and function types (A) -> B. At the end: a practical refactoring (report source + printer) and a list of common design mistakes.
    Open
  • Type projections: safe Array<out/in> and projections for MutableList

    Kotlin SELF
    36 level,2 lecture
    We break down why Array<T> in Kotlin is invariant, why casts via as are dangerous, and how use-site variance (type projections) “trims” the reference API down to a safe mode: out for reading (producer) and in for writing (consumer). We reinforce it with examples of copying arrays and contracts for MutableList, including a practical scenario with financial operations.
    Open
  • Star-projection *: List<*>

    Kotlin SELF
    36 level,3 lecture
    We break down star-projection * in Kotlin using List<*> and MutableList<*> as examples: what exactly “unknown type” means, why elements become Any? when reading, why writing into MutableList<*> is forbidden (the logic of in Nothing), how to use checks like is List<*>, and how the asterisk relates to out/ in projections. At the end: practical examples and common mistakes.
    Open
  • Type erasure and inline/reified: is T, as? T, and T::class checks

    Kotlin SELF
    36 level,4 lecture
    Let’s break down why generic types are “erased” on the JVM ( type erasure), why checks like is T and List < Int > are forbidden, and how to perform checks/casts legally using inline + reified. In practice, we’ll write universal utilities with as?, use T::class for messages, and collect elements of the required type from a List < Any >.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success stories
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush