CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • == vs === and the “value vs reference” model

    Kotlin SELF
    Level 23, Lesson 0
    We break down two kinds of equality in Kotlin: structural comparison via == (by value, via equals and safe for null) and referential comparison via === (object identity). We discuss aliasing with collections, why val does not make an object immutable, the === trap with nullable numbers ( Int?), and practical techniques like copying a list via toList() to get a data “snapshot”.
    Available
  • Basic list sorting — sorted() / sortedDescending()

    Kotlin SELF
    Level 23, Lesson 1
    We break down basic list sorting in Kotlin without mutations: how sorted() and sortedDescending() work, what “natural order” means and what Comparable has to do with it, why it’s important not to break the original data, and how to apply sorting in the mini project ExpensePocket. At the end: a walkthrough of typical mistakes (lost result, confusing “sorting vs reversing,” unnecessary sorting just to get max/min).
    Available
  • Sorting by a key and multiple criteria in Kotlin

    Kotlin SELF
    Level 23, Lesson 2
    We cover sorting collections in Kotlin “by a key” using sortedBy and sortedByDescending, build the top‑N pattern as sortedByDescending(...) + take( n), and also learn how to sort by multiple criteria with sortedWith and compareBy. Along the way, we reinforce the difference between an “element” and a “sorting key” and common mistakes (for example, using take without sorting).
    Available
  • Nullable in sorting: defaults, splitting, and a clear rule for null

    Kotlin SELF
    Level 23, Lesson 3
    Let’s break down how to sort collections in Kotlin when the key can be null: why sorting needs an explicit contract (“ null first/last”), how to use the Elvis operator ?: with safe defaults ( sortedBy, sortedByDescending), why “magic numbers” like Int . MAX_VALUE can be dangerous, and when it’s better to split the data ( filterNotNull(), counting null, split+merge). Everything is shown using an expense report example in a fictional app called BudgetBuddy.
    Available
  • Comparing arrays: why == is not suitable and when you need contentDeepEquals

    Kotlin SELF
    Level 23, Lesson 4
    We break down why arrays in Kotlin/JVM are not compared element-by-element via ==, how == and === differ, and which functions to use for correct data comparison: contentEquals() for flat arrays and contentDeepEquals() for nested ones. We also separately discuss the aliasing trap (“before/after” without a copy) and practical ways to diagnose issues using joinToString() and contentDeepToString().
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym