JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Functional interfaces: Predicate, Consumer, Supplier, Function

    JAVA 25 SELF
    49 level,0 lecture
    We break down the key functional interfaces from the java.util.function package: Predicate, Consumer, Supplier, Function—what they accept/return and where they are used in the Stream API ( filter, map, forEach, generate). We recall the “exactly one abstract method” rule and the @FunctionalInterface annotation, write lambdas, compare them with anonymous classes, practice with a User class example, and analyse common pitfalls when choosing between Predicate/ Function, etc.
    Open
  • Function composition: compose, andThen

    JAVA 25 SELF
    49 level,1 lecture
    This lecture is about building transformation pipelines from small functions using Function and its methods compose and andThen. We will cover execution order, type compatibility, examples with Predicate ( and, or, negate), Consumer ( andThen), build practical pipelines, and discuss common pitfalls: mixed-up order ( f.compose(g) vs f.andThen(g)), mismatched types, and “spaghetti” chains. You will learn to use apply, test, accept and to build readable, reusable transformations.
    Open
  • Passing Functions as Parameters: Examples

    JAVA 25 SELF
    49 level,2 lecture
    A practical introduction to passing behavior in Java: how to use lambda expressions ( ->) and method references ( ::) together with the Stream API and collections. We’ll cover the standard functional interfaces from java.util.function — Comparator, Predicate, Function, Consumer, Supplier — learn to write generic methods, accept behavior as parameters, and avoid common mistakes. We’ll practice with examples using Stream, Optional, and our own list-processing utilities.
    Open
  • Functional style with the Stream API

    JAVA 25 SELF
    49 level,3 lecture
    We move from imperative loops to declarative data-processing pipelines with the Stream API: we cover intermediate and terminal operations, lazy evaluation, collecting results via toList()/ collect, the key operations map, filter, sorted, flatMap, reduce, as well as checks anyMatch/ allMatch/ noneMatch. We’ll compare imperative and functional styles, walk through practical examples, and cover common mistakes, including misusing forEach for collecting and premature parallelStream().
    Open
  • Debugging errors in functional programming

    JAVA 25 SELF
    49 level,4 lecture
    The 10 most common mistakes when working with lambdas and the Stream API in Java: variable capture ( final/ effectively final), the behavior of this in lambdas, side effects and parallelism ( parallelStream()), type inference and generics, working with null and Optional, function composition ( compose/ andThen), as well as checked exceptions (for example, IOException). We show safe practices: filtering with Objects::nonNull, terminal operations ( sum(), collect(...)), thread-safe collections, and decomposing long chains.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy