GoConqr has a new look! Let us know what you think.

Mind map

Generics

Jose Juan Ramírez Spanish

Map content

Generics

  1. Generics

    • Type parameter: placeholder for a type declared in a generic
    • Type argument: actual type used to parametrize a generic
  2. Generic Constrainst

    • Type parameter bound: limit possible values of type argument. We need to explicity define a type parameter upper bound
    • Nullabilty: non-nullable and nulable types as type argument. We need to explicity define a non-nullable type explicity
  3. Variance

    • Modifiers
      • Covariant: subtyping is preserved
        • out
      • Contravarient: reversed
        • in
      • Invariant: ignored. Default
    • Place in the code
      • use-site
      • declaration-site
    • Collection
      • Invariant by default
      • List: co-variant
      • MutableList: invariant
    • Limitation: only limited to a single position
      • in: method parameters
      • out: method return value
    • Constructor
      • parameters are always invariant
  4. Type erasure

    • Process of removing a type argument from a generic type
      • JvmName to change the name of one of the methods
    • Reified
      • special modier that can preserve a type-argument at runtime
      • only with inline functions
  5. Star-projections

    • way to say that information about type argument is missing or it is not important
  6. programming style where classes, fuctions, data structures or algorithms are written in such way that the exact type can be specified late

Information

Description
Mind Map on Generics, created by Jose Juan Ramírez on 12/01/2018.
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?