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

Kursinhalt

Stream API

Stream API

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

book
Challenge: Factory Quality Control

Aufgabe

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.

Lösung

java

solution

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 8
toggle bottom row

book
Challenge: Factory Quality Control

Aufgabe

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.

Lösung

java

solution

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 8
Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
We're sorry to hear that something went wrong. What happened?
some-alt