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
  • Nullable as a contract: where null is justified and where it gets in the way

    Kotlin SELF
    41 level,0 lecture
    We break down nullable types in Kotlin as a contract: what String ? really means, when the safe call ?. and the Elvis operator ?: are the norm at system boundaries (input, parsing, lookup), and when null starts to “leak” into business logic. Using examples with toIntOrNull(), lookups in Map, and a mini app ExpenseTracker, we learn to localize nullable usage and avoid anti-patterns like !! and sentinels ( 0, - 1, "UNKNOWN").
    Open
  • What to use instead of null: preconditions, sealed results, Result

    Kotlin SELF
    41 level,1 lecture
    We break down why null often turns into a “foggy contract”, and what to replace it with in Kotlin in a practical way: preconditions ( require/ check and the *NotNull variants), meaningful results via sealed classes (an exhaustive when), and also the standard container Result<T> for “error as a value”. Using a CLI expense tracker as an example, we show how to distribute these approaches across layers and avoid common pitfalls.
    Open
  • Smart cast and how to use it

    Kotlin SELF
    41 level,2 lecture
    Let’s break down how smart cast works in Kotlin: when the compiler “promises” you a narrower type without as and without !!, why it sometimes refuses (instability of var, properties like obj . prop, lambdas, repeated reads), and which techniques help: taking a snapshot into a local val, guard clauses with return, and also an explicit conversion of T? -> T via requireNotNull/ checkNotNull. At the end — a practical example with searching for an Expense? and a cheat-sheet table.
    Open
  • Removing null from collections and transformation pipelines

    Kotlin SELF
    41 level,3 lecture
    We’ll go over practical “sanitation” for Kotlin collections: why List<T?> quickly infects a pipeline with checks, how to “kill” null early with filterNotNull() and mapNotNull(), how to build an input-normalization gateway, carefully handle search results ( find/ firstOrNull), and transform Map<K, V?> into Map<K, V> without !!. At the end—nuances of takeIf/ takeUnless and common mistakes.
    Open
  • Designing a model without nullable fields

    Kotlin SELF
    41 level,4 lecture
    We break down a practical approach to modeling in Kotlin: keep null at the boundary (input/external data), normalize strings via trim(), parse numbers via toIntOrNull(), return errors explicitly via a sealed class ( Ok/ Error), and in the domain model use only strict types without ? and protect invariants with require(...).
    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