Skip to content
The Kotlin Primer
Menu
Menu
Introduction
π‘ Β· Understanding the Kotlin Primer
π‘ Β· Maintainability
Basics
Functions & Variables
π Β· Functions
π Β· Variables
Control Flow
ποΈ Β· When expression
π Β· Loops
π Β· If expression
Miscellaneous
ποΈ Β· Ranges
ποΈ Β· Strings & string templates
Nullability & Types
ποΈΒ Β·Β Nullability βοΈ
π Β·Β Types
Functions continued
π Β· Literals
π Β· Function types & literals βοΈ
ποΈ Β· Inline functions
ποΈ Β· Tail-recursive functions
π Β· Variable number of arguments
Classes β What we know from Java
Introduction
π Β· Basic class syntax
ποΈ Β· Constructors βοΈ
Properties
ποΈ Β· Basics
ποΈ Β· Accessors
ποΈ Β· Backing fields
π Β· Accessors, continued βοΈ
π Β· Compile-time constants
ποΈ Β· Lateinit
Inheritance
π Β· Basics
π Β· Overriding
Miscellaneous
π Β· Interfaces
π Β· Visibility modifiers
ποΈ Β· Nested and inner classes
Generics
π Β· Basics
π Β· Generic variance β motivation
π Β· Generic variance β fundamental principles
ποΈ Β· Covariance, Contravariance, Invariance
ποΈ Β· Star Projections
Classes β Whatβs new in Kotlin
Data Classes
ποΈ Β· Data Classes βοΈ
Objects
ποΈ Β· Object Declarations
ποΈ Β· Object Expressions
ποΈ Β· Companion Objects βοΈ
Delegation
π Β· Delegating interface implementation βοΈ
π Β· Delegated Properties βοΈ
π Β· Summary
Sealed hierarchies
π Β· Introduction
π Β· Safely Emulating Dynamic Dispatch
π Β· Modeling Illegal States
π Β· Modeling States and Structure
π Β· Modeling States and Structure: Considerations
Miscellaneous
ποΈ Β· Reified Type Parameters
π Β· Enums
ποΈ Β· Infix Functions
ποΈ Β· Operators
ποΈ Β· Type Aliases
π Β· Inline (Value) Classes
π Β· Functional (SAM) Interfaces
Extension Functions
Basics
π Β· Motivation
π Β· Syntax and Behavior
π Β· Functions with Receiver
ποΈ Β· Qualified This βοΈ
π Β· What Extension Functions Are Not
Applications
π Β· Nullable & Generic Receivers βοΈ
ποΈ Β· Generic Receivers β continued
ποΈ Β· Operators as Extensions
Scope functions
π Β· Introduction
π Β· also() & apply()
π Β· also() vs. apply()
π Β· let() & takeX()
π Β· run()
π Β· with(), run() vs. with()
π Β· Closing Remarks & Exercises βοΈ
Domain Specific Languages
π Β· What makes a DSL
π Β· How to make your own βοΈ
Standard Library
Programming with Result
π Β· Motivation
π Β· Returning a Result
π Β· kotlin.Result
π Β· Combining and Composing Results
π Β· Considerations
Collections & Elementary Functional Programming
π Β· Basic Collections: Introduction
π Β· Functional vs. (?) Object-Oriented Programming
π Β· Collection Operations: Overview
π Β· Transformations
π Β· Filtering
π Β· Single-element access
π Β· Predicates
π Β· Aggregators
π Β· Grouping
Sequences
π Β· Why we need them
π Β· How They Work & How To Use Them
π Β· Yield vs. Return & How Pausing Functions Work
π Β· Iterable vs. Sequence vs. Java Stream
Nullability & Types
ποΈΒ Β·Β Nullability βοΈ
π Β·Β Types
Search for:
The Kotlin Primer
Search
Introduction
π‘ Β· Understanding the Kotlin Primer
π‘ Β· Maintainability
Basics
Functions & Variables
π Β· Functions
π Β· Variables
Control Flow
ποΈ Β· When expression
π Β· Loops
π Β· If expression
Miscellaneous
ποΈ Β· Ranges
ποΈ Β· Strings & string templates
Nullability & Types
ποΈΒ Β·Β Nullability βοΈ
π Β·Β Types
Functions continued
π Β· Literals
π Β· Function types & literals βοΈ
ποΈ Β· Inline functions
ποΈ Β· Tail-recursive functions
π Β· Variable number of arguments
Classes β What we know from Java
Introduction
π Β· Basic class syntax
ποΈ Β· Constructors βοΈ
Properties
ποΈ Β· Basics
ποΈ Β· Accessors
ποΈ Β· Backing fields
π Β· Accessors, continued βοΈ
π Β· Compile-time constants
ποΈ Β· Lateinit
Inheritance
π Β· Basics
π Β· Overriding
Miscellaneous
π Β· Interfaces
π Β· Visibility modifiers
ποΈ Β· Nested and inner classes
Generics
π Β· Basics
π Β· Generic variance β motivation
π Β· Generic variance β fundamental principles
ποΈ Β· Covariance, Contravariance, Invariance
ποΈ Β· Star Projections
Classes β Whatβs new in Kotlin
Data Classes
ποΈ Β· Data Classes βοΈ
Objects
ποΈ Β· Object Declarations
ποΈ Β· Object Expressions
ποΈ Β· Companion Objects βοΈ
Delegation
π Β· Delegating interface implementation βοΈ
π Β· Delegated Properties βοΈ
π Β· Summary
Sealed hierarchies
π Β· Introduction
π Β· Safely Emulating Dynamic Dispatch
π Β· Modeling Illegal States
π Β· Modeling States and Structure
π Β· Modeling States and Structure: Considerations
Miscellaneous
ποΈ Β· Reified Type Parameters
π Β· Enums
ποΈ Β· Infix Functions
ποΈ Β· Operators
ποΈ Β· Type Aliases
π Β· Inline (Value) Classes
π Β· Functional (SAM) Interfaces
Extension Functions
Basics
π Β· Motivation
π Β· Syntax and Behavior
π Β· Functions with Receiver
ποΈ Β· Qualified This βοΈ
π Β· What Extension Functions Are Not
Applications
π Β· Nullable & Generic Receivers βοΈ
ποΈ Β· Generic Receivers β continued
ποΈ Β· Operators as Extensions
Scope functions
π Β· Introduction
π Β· also() & apply()
π Β· also() vs. apply()
π Β· let() & takeX()
π Β· run()
π Β· with(), run() vs. with()
π Β· Closing Remarks & Exercises βοΈ
Domain Specific Languages
π Β· What makes a DSL
π Β· How to make your own βοΈ
Standard Library
Programming with Result
π Β· Motivation
π Β· Returning a Result
π Β· kotlin.Result
π Β· Combining and Composing Results
π Β· Considerations
Collections & Elementary Functional Programming
π Β· Basic Collections: Introduction
π Β· Functional vs. (?) Object-Oriented Programming
π Β· Collection Operations: Overview
π Β· Transformations
π Β· Filtering
π Β· Single-element access
π Β· Predicates
π Β· Aggregators
π Β· Grouping
Sequences
π Β· Why we need them
π Β· How They Work & How To Use Them
π Β· Yield vs. Return & How Pausing Functions Work
π Β· Iterable vs. Sequence vs. Java Stream