Question 267 of 481
1Z0-811 Java Basics and Syntax Practice Question
A mobile app backend uses Java streams to process user data. The code snippet filters users who are active and older than 18, then collects them into a list:
List<User> result = users.stream() .filter(u -> u.isActive()) .filter(u -> u.getAge() > 18) .collect(Collectors.toList());
Performance metrics show that this stream operation is slow when the user list has millions of entries. The team wants to improve performance without changing the business logic. Which change would most likely improve performance?
⚠ Common exam trap
Watch out — candidates often think combining filters (Option D) is the most effective optimization, but the Oracle exam tests the understanding that parallelization is the key performance lever for large data sets, not minor syntactic changes.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Replace .stream() with .parallelStream().
Replacing `.stream()` with `.parallelStream()` enables parallel processing of the stream, which can leverage multiple CPU cores to process the filter operations concurrently. For large datasets (millions of entries), this can significantly reduce execution time by splitting the workload across threads, while preserving the same business logic and order of operations.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Replace .stream() with .parallelStream().
Why this is correct
Parallel processing can utilize multiple cores for large datasets.
- ✗
Use a HashSet instead of List for users collection.
Why it's wrong here
Does not affect filtering speed.
- ✗
Replace the stream with a traditional for loop.
Why it's wrong here
Might be slightly faster but less scalable.
- ✗
Combine both filters into one using logical AND operator.
Why it's wrong here
Minimal impact; still sequential.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 25, 2026
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.