Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Factory Quality Control | Intermediate Operations in Stream API
Stream API
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

Завдання

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.

Рішення

java

solution

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 8
toggle bottom row

book
Challenge: Factory Quality Control

Завдання

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.

Рішення

java

solution

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 8
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt