How can you limit a Stream? #javalanguage #javacoding #javatips #javacodinginterview

preview_player
Показать описание
Cracking the #Java #Coding #Interview - Question 223: How can you limit a stream?
Рекомендации по теме
Комментарии
Автор

Why can't it be used in parallel streams? Is the counter not atomic?

Quinteger
Автор

Parallel stream sounds like a double edge sword 😅 one wrong move and you cut yourself 😢

VuLinhAssassin
Автор

old boy Sir java understands everything about java development but best is proceed step by step with ease 😂

HamzaEngineering
Автор

you're completely right. first thing to handle is grouping elements by same criteria then ordering those elements before finally applying skip and limit keywords to avoid processing specific items. i did the same when i was working on batch application when i needed to process only what called detail records and forget metadata and rank of those records in the list 🫡✌️ record:{metadata, detail, order} like record1 and record2 and then until Nrecord===last one in the list

HamzaEngineering
Автор

Smells like a gatherer function here like skipThenLimit

AdrianHanda
visit shbcf.ru