Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Factory Quality Control | Intermediate Operations in Stream API
Stream API
course content

Course Content

Stream API

Stream API

1. Fundamentals and Functional Capabilities of Stream API
4. Practical Applications of Stream API

book
Challenge: Factory Quality Control

Task

Swipe to start coding

A factory receives multiple batches of parts, but some parts are defective and must be removed to identify high-quality components, which should be displayed without duplicates.

The PartBatch class represents a batch of parts, with a batch name (batchName) and a list of parts (parts). To access the list of parts from a batch, you use the getParts() method, and to retrieve the batch name, you use the getBatchName() method.

  1. Extract all parts from each batch using flatMap() method.
  2. Filter out defective parts by checking if the part name starts with Defective using filter() method.
  3. Remove duplicate parts to get a list of unique quality parts using distinct() method.

Solution

java

solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 8
toggle bottom row

book
Challenge: Factory Quality Control

Task

Swipe to start coding

A factory receives multiple batches of parts, but some parts are defective and must be removed to identify high-quality components, which should be displayed without duplicates.

The PartBatch class represents a batch of parts, with a batch name (batchName) and a list of parts (parts). To access the list of parts from a batch, you use the getParts() method, and to retrieve the batch name, you use the getBatchName() method.

  1. Extract all parts from each batch using flatMap() method.
  2. Filter out defective parts by checking if the part name starts with Defective using filter() method.
  3. Remove duplicate parts to get a list of unique quality parts using distinct() method.

Solution

java

solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 8
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt