Skip to content
javabypankaj
HomeLibraryPopularCommunity
06
Java Streams, Lambda & Functional Programming
30 topics · 328 questions
1Lambda Expressions0/552Functional Interfaces0/13133Method References0/554Default & Static Methods in Interfaces0/335Stream API Fundamentals0/886Stream: filter0/19197Stream: map & Transform0/34348Stream: flatMap0/779Stream: Sorting & Comparator0/232310Stream: reduce & Aggregate0/9911Stream: Grouping & Partitioning0/222212Collectors0/212113Optional0/9914Primitive Streams0/2215Stream Creation & Utilities0/181816Parallel Streams0/101017Stream: Exception Handling0/4418Stream: Performance & Pitfalls0/519Stream: Predict the Output0/7720Stream Practice: Employee Analysis0/434321Stream Practice: String & Character0/111122Stream Practice: Collections & Numbers0/111123Stream: Complex Pipelines0/8824Date/Time API0/2225Java 11 Features0/5526Java 17 Features0/3327Java 21+ Features0/101028Java 24/25 Preview0/8829Records0/1130Functional Programming Concepts0/22
1Lambda Expressions52Functional Interfaces133Method References54Default & Static Methods in Interfaces35Stream API Fundamentals86Stream: filter197Stream: map & Transform348Stream: flatMap79Stream: Sorting & Comparator2310Stream: reduce & Aggregate911Stream: Grouping & Partitioning2212Collectors2113Optional914Primitive Streams215Stream Creation & Utilities1816Parallel Streams1017Stream: Exception Handling418Stream: Performance & Pitfalls519Stream: Predict the Output720Stream Practice: Employee Analysis4321Stream Practice: String & Character1122Stream Practice: Collections & Numbers1123Stream: Complex Pipelines824Date/Time API225Java 11 Features526Java 17 Features327Java 21+ Features1028Java 24/25 Preview829Records130Functional Programming Concepts2
30 topics328 Qs0%
01Core Java17002OOP3203Collections6704Exception Handling2805Concurrency & Multithreading12706Java Streams, Lambda & Functional Programming32807Spring & Spring Boot2608Transactions3209JPA & Hibernate6910Microservices19411Kafka & Messaging9112DevOps, CI/CD & Tooling13313Database & SQL14114REST API & Web4015Design Patterns & LLD5716Advanced Java7117Coding Problems: DSA49218AWS & Cloud4119Data Engineering19420QA, Testing & SDET4121System Design3522Security2023Behavioral / HR: STAR Method37
30Topics
328Questions
0%Complete
18 of 30 topics
Topics
1Lambda Expressions0/552Functional Interfaces0/13133Method References0/554Default & Static Methods in Interfaces0/335Stream API Fundamentals0/886Stream: filter0/19197Stream: map & Transform0/34348Stream: flatMap0/779Stream: Sorting & Comparator0/232310Stream: reduce & Aggregate0/9911Stream: Grouping & Partitioning0/222212Collectors0/212113Optional0/9914Primitive Streams0/2215Stream Creation & Utilities0/181816Parallel Streams0/101017Stream: Exception Handling0/44
18Stream: Performance & Pitfalls0/55
19Stream: Predict the Output0/7720Stream Practice: Employee Analysis0/434321Stream Practice: String & Character0/111122Stream Practice: Collections & Numbers0/111123Stream: Complex Pipelines0/8824Date/Time API0/2225Java 11 Features0/5526Java 17 Features0/3327Java 21+ Features0/101028Java 24/25 Preview0/8829Records0/1130Functional Programming Concepts0/22

Stream: Performance & Pitfalls

Java Streams, Lambda & Functional Programming·Topic 18 of 30·5 questions
Q1Stream.peek(): debugging only, may be optimized away, side effects unreliable

Stream.peek is a debugging-only intermediate operation that may be optimized away by the JVM, making it unreliable for business logic or side effects.

Read Answer
Q2When should you use toArray() vs collect(toList())?

Default to `collect(toList())` for flexibility; use `toArray()` only for array-demanding APIs, primitives, or varargs.

Read Answer
Q3Why is using a HashSet for the lookup list faster than filter(list::contains) for intersection queries?

`list::contains` is O(n*m) for intersection; `set::contains` is O(n+m) because HashSet lookup is O(1) average.

Read Answer
Q4Why is list.stream().filter(...).count() sometimes more efficient than collect(toList()).size()?

`count()` tallies without building a list; `collect(toList()).size()` wastes memory materializing a list just to read its size.

Read Answer
Q5Explain why peek() should NOT be used for side effects in production code

The pipeline may legally skip `peek`, so never put real work in it; use `map`, `forEach`, or a collector instead.

Read Answer
Previous · Topic 17Stream: Exception Handling4 questionsNext · Topic 19Stream: Predict the Output7 questions
javabypankaj© 2026 javabypankaj
PrivacyTerms
HomeSearchLibrary