GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Generics

Jose Juan Ramírez Spanisch

Inhalt der Mindmap

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

Informationen

Beschreibung
Mindmap am Generics, erstellt von Jose Juan Ramírez am 12/01/2018.
Erstellt von
Jose Juan Ramírez
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck