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
  • flatMap and mapMulti methods

    JAVA 25 SELF
    32 level,0 lecture
    In this lecture, we will figure out the difference between transforming data via map, “flattening” transformation via flatMap, and a more efficient analogue introduced in Java 16+ — mapMulti. With practical examples, we’ll clearly see how to unpack nested collections into Stream<String> instead of Stream<Stream<String>>, how to work with Optional via stream(), and when to choose mapMulti for performance without creating intermediate streams.
    Open
  • join, concat methods: merging streams

    JAVA 25 SELF
    32 level,1 lecture
    In this lecture, we examine ways to merge data in the Stream API: the static method Stream.concat for two streams, the combination of Stream.of + flatMap for an arbitrary number of streams, and the collector Collectors.joining for gluing elements into a single string. We will talk about laziness, the single-use nature of streams, order preservation, and common mistakes (reusing a stream, infinite streams, joining for non-strings) — with illustrative examples.
    Open
  • Union, intersection, and difference operations

    JAVA 25 SELF
    32 level,2 lecture
    In this lecture, we explore common set operations in Java: union ( union), intersection ( intersection), and difference ( difference) using the Set interface and the Stream API. We show practical examples with Stream.concat, Stream.of + flatMap, alternatives via retainAll/ removeAll, and important nuances about equals/ hashCode, performance, and common mistakes.
    Open
  • Zipping (zip), stream generation (iterate, generate)

    JAVA 25 SELF
    32 level,3 lecture
    In this lecture, we will discuss what zip is and why it is not in the standard Stream API (up to Java 22), learn how to “stitch” collections via indices using IntStream.range, as well as create streams on the fly using Stream.iterate and Stream.generate. Examples, visualisations, and typical mistakes will help you confidently apply generation and zipping in tasks.
    Open
  • Breakdown of common mistakes when working with streams

    JAVA 25 SELF
    32 level,4 lecture
    A detailed guide to common mistakes when working with the Stream API in Java: the single-use nature of a stream and repeated terminal operations ( collect(), forEach(), count()), modifying a collection during traversal, a forgotten limit() on infinite streams ( iterate, generate), handling null and working with Optional via flatMap(Optional::stream), preserving order with forEachOrdered(), efficient set operations with Set, proper resource closing ( Files.lines + try-with-resources), caution with parallelStream(), and the principle “until a terminal operation is invoked — nothing executes.” Every issue is accompanied by clear examples and fixes.
    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