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
  • Lambda expressions in Kotlin: syntax, it, return value

    Kotlin SELF
    21 level,0 lecture
    We break down lambda expressions in Kotlin as “values”: how to store a lambda in val and call it like a function, how the basic syntax -> works, when you can use the it parameter, why the result of a lambda is the last expression (and how to accidentally return Unit), and where the compiler needs type hints (for example, (Int) -> Boolean) and which errors are most common.
    Open
  • Function types and higher-order functions

    Kotlin SELF
    21 level,1 lecture
    We break down how to read Kotlin function types of the form (A) -> B, what a predicate (T) -> Boolean is, why higher-order functions are needed, and how to stop copying loops by passing “behavior” as a parameter. In practice, we will write our own versions of countMatching, forEachIf, and findFirstOrNull and apply them to a mini expense-tracking project on MutableList with a Triple model.
    Open
  • Callable references :: — passing a named function instead of a lambda

    Kotlin SELF
    21 level,2 lecture
    We break down callable references in Kotlin via the :: operator: how to replace a wrapper lambda like { x -> f(x) } with a reference ::f, why this works only when the signature matches strictly ( (T) -> R), how to store a function reference in a val, and where :: improves readability (predicates, input-processing steps) — with examples and a breakdown of common mistakes.
    Open
  • Comparison function and Comparator: lambda (T, T) -> Int

    Kotlin SELF
    21 level,3 lecture
    We break down the comparison contract via a function of the form ( T , T ) -> Int: why order needs three outcomes (less/equal/greater), how to assemble a Comparator<T> with the compare method from a lambda, how to apply a comparator to pick the “best” element without sorting, how to do a tie-breaker via return @ Comparator, and why it’s better to write compareTo instead of a - b.
    Open
  • Closures and side effects

    Kotlin SELF
    21 level,4 lecture
    We break down closures in Kotlin: how lambdas and local functions capture outer context, how capturing val differs from capturing var, and why an “innocent” predicate like (Int) -> Boolean can suddenly become a source of hidden state and side effects (for example, via println or a counter). At the end, there is a practical mini-case with Triple and a set of habits that help keep effects visible and local (separating predicate and action, short lifetime of closures).
    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