Kotlin Professional Certificate key terms
Kotlin Professional Certificate · Get comfortable with the vocabulary.
- val
- Related: var, immutability
Declares a read-only reference: the variable cannot be reassigned after initialization, though the object it points to may still be mutable. Preferred default in Kotlin code.
- var
- Related: val
Declares a mutable reference that can be reassigned to a new value. Use only when reassignment is genuinely needed; the compiler warns about unnecessary use.
- Null safety
- Related: Safe call operator, Elvis operator, Smart cast
The type system distinguishes nullable types (String?) from non-nullable ones (String). Nullable values must be handled via safe calls, Elvis operator, or explicit checks before use.
- Safe call operator
- Related: Elvis operator, Null safety
The ?. operator performs a call only when the receiver is non-null, otherwise returning null. Chains short-circuit, so a?.b?.c never throws for null links.
- Elvis operator
- Related: Safe call operator, Null safety
The ?: operator returns the left operand if it is non-null, otherwise evaluates and returns the right operand. Commonly supplies defaults or triggers early return via ?: return.
- Smart cast
- Related: Null safety, Type check operator
After a null check or type check, the compiler automatically treats a value as the narrower type within that scope. Fails for mutable properties unless they are local or val.
- Type check operator
- Related: Smart cast, Type cast operator
The is and !is operators test whether a value is an instance of a type, enabling a smart cast in the following branch. Replaces Java's instanceof.
- Type cast operator
- Related: Type check operator, Smart cast
The as operator casts a value, throwing ClassCastException on mismatch; as? performs a safe cast returning null instead of throwing. Used with is checks for safe downcasting.
- String template
- Related: Raw string
Interpolation inside string literals: $name inserts a variable, ${expression} inserts any expression result. Eliminates most string concatenation and improves readability.
- Raw string
- Related: String template
A triple-quoted literal that keeps newlines and backslashes verbatim, with no escape processing. trimIndent and trimMargin remove common leading whitespace.
- when expression
- Related: Sealed class, Smart cast
A branch construct that returns a value and supports constants, ranges, type checks, and arbitrary boolean conditions. Exhaustive when used as an expression over enums or sealed types.
- Range
- Related: when expression, Collections vs sequences
An interval created with .. or until, supporting iteration and the in operator. Int ranges are efficient; downTo and step adjust direction and stride.
- Function default and named arguments
- Related: Extension function, Higher-order function
Parameters may declare default values, letting callers skip them; callers may also name arguments to reorder or clarify calls. Reduces overload boilerplate significantly.
- Extension function
- Related: Extension property, Higher-order function
Adds a callable function to an existing type without modifying or inheriting from it. Resolved statically, so it cannot override member functions and receives the receiver as this.
- Extension property
- Related: Extension function
Declares a property-like accessor on an existing type. Because it has no backing field, it must define get (and optionally set) explicitly rather than storing state.
- Data class
- Related: Destructuring declaration, Primary constructor
A class whose primary-constructor properties automatically generate equals, hashCode, toString, copy, and componentN functions. Must have at least one parameter and cannot be abstract.
- Sealed class
- Related: when expression, Data class
A class whose direct subclasses are restricted to the same module and known at compile time. Enables exhaustive when expressions, making it ideal for modeling closed result hierarchies.
- Primary constructor
- Related: Data class, Visibility modifier
The constructor declared in the class header, defining parameters and optionally properties via val/var. Initialization logic goes in init blocks executed in declaration order.
- Visibility modifier
- Related: Primary constructor, Object declaration
Controls access: private, protected, internal (module-wide), and public (default). Kotlin has no package-private; internal is the common module-level alternative.
- Object declaration
- Related: Visibility modifier, Extension function
Defines a singleton in one statement, initialized lazily on first access. Companion objects attach static-like members to a class and can implement interfaces.
- Higher-order function
- Related: Lambda expression, Inline function
A function that takes functions as parameters or returns one. Enables abstraction over behavior; inline modifiers can remove lambda allocation overhead.
- Lambda expression
- Related: Higher-order function, Inline function
An anonymous function literal written in braces, with parameters before -> and a final expression as the return value. A trailing lambda moves outside the parentheses.
- Inline function
- Related: Lambda expression, Reified type parameter
A function whose body and lambda arguments are copied into call sites by the compiler, avoiding object allocation. Needed for non-local returns and reified type parameters.
- Reified type parameter
- Related: Inline function
A generic parameter made available at runtime inside an inline function, allowing is checks and class references on T. Only valid on inline functions.
- Destructuring declaration
- Related: Data class, Pair and Triple
Unpacks an object into several variables using componentN functions, as in val (a, b) = pair. Data classes and maps support this out of the box.
- Immutability
- Related: val, Read-only vs mutable collections
The practice of preferring read-only references and immutable collections so state cannot change unexpectedly. Central to safe concurrency and predictable functional transformations.
- Read-only vs mutable collections
- Related: Immutability, Collection transformation
Kotlin separates interfaces like List from MutableList. A read-only reference may still point to a mutable implementation, so it is a view guarantee, not deep immutability.
- Collection transformation
- Related: Collections vs sequences, Read-only vs mutable collections
Operations such as map, filter, flatMap, and groupBy that build new collections from existing ones. They return new instances rather than modifying the source.
- Collections vs sequences
- Related: Collection transformation, Terminal operation
Collection operations are eager and build intermediate lists; sequence operations are lazy and evaluated on terminal operations. Sequences win for long chains over large data.
- Terminal operation
- Related: Collections vs sequences
A sequence operation such as toList, first, or count that triggers evaluation of the lazy pipeline. Without one, intermediate sequence steps never execute.
- Pair and Triple
- Related: Destructuring declaration, Data class
Small standard-library tuples holding two or three values. Useful for returning multiple results and for destructuring, though named data classes are clearer for public APIs.
- Scope function
- Related: Safe call operator, Higher-order function
let, run, with, apply, and also execute a block with a receiver, differing in receiver reference (it vs this) and return value (receiver vs block result).
- Coroutine
- Related: Suspend function, CoroutineScope, Structured concurrency
A suspendable computation managed by the kotlinx.coroutines library. Coroutines can pause without blocking a thread, enabling scalable asynchronous and concurrent code.
- Suspend function
- Related: Coroutine, CoroutineScope
A function marked suspend that may pause and resume without blocking its thread. Callable only from coroutines or other suspend functions.
- CoroutineScope
- Related: Structured concurrency, Coroutine, Job and cancellation
Defines the lifetime and context of coroutines launched within it. Cancelling a scope cancels its children; launch and async are extension functions on it.
- Structured concurrency
- Related: CoroutineScope, Job and cancellation
A parent coroutine does not complete until all its children finish, and failure or cancellation propagates through the hierarchy. Prevents leaked background work.
- Job and cancellation
- Related: CoroutineScope, Structured concurrency
Every coroutine has a Job representing its lifecycle. cancel requests cooperative cancellation; suspend points check it, and CancellationException unwinds normally.
- Gradle Kotlin DSL
- Related: Kotlin compiler plugin
Build scripts written in Kotlin (build.gradle.kts) instead of Groovy, giving type-safe accessors, IDE completion, and compile-time checking of build configuration.
- Kotlin compiler plugin
- Related: Gradle Kotlin DSL, Annotation
An extension to the compiler that generates or transforms code, such as kotlinx.serialization or the all-open plugin. Configured through Gradle dependencies.
- Annotation
- Related: Kotlin compiler plugin
Metadata attached to declarations using @ syntax, retained at source, binary, or runtime as configured. Used for frameworks, serialization, and compiler plugins.
- kotlin.test
- Related: Test fixture and lifecycle, Assertion
The multiplatform testing library providing assertions like assertEquals and annotations such as @Test. Backed at runtime by JUnit, TestNG, or other frameworks.
- Assertion
- Related: kotlin.test, Test fixture and lifecycle
A statement that verifies an expected outcome in a test, such as assertEquals or assertFailsWith. A failed assertion aborts the test and reports the mismatch.
- Test fixture and lifecycle
- Related: kotlin.test, Assertion
Setup and teardown hooks (@BeforeTest, @AfterTest) that prepare shared state around each test. Ordering and isolation matter for reliable, repeatable results.