Courseiva
Working with Streams and Lambda ExpressionsmediumMultiple SelectObjective-mapped

1Z0-829 Working with Streams and Lambda Expressions Practice Question

Which TWO are valid ways to obtain a Stream from a List<String> named 'list'? (Choose two.)

⚠ Common exam trap

Test-takers frequently confuse `Stream.of(list)` with `list.stream()`, not realizing that `Stream.of()` treats the collection as a single element, and may also incorrectly think `Stream` can be instantiated with `new` like a regular class.

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

list.stream()

Options A and E are correct. The `List` interface provides the `stream()` method to obtain a sequential stream and `parallelStream()` to obtain a parallel stream. Option B is incorrect because `Stream.of(list)` treats the list itself as a single element, producing a `Stream<List<String>>` rather than a `Stream<String>`. Option C is incorrect because `Arrays.stream(list.toArray())` would work if you had a String array, but it returns a `Stream<Object>` since `toArray()` returns `Object[]`; this is not type-safe and not a direct way to get a stream from a list. Option D is incorrect because `Stream` is an interface and cannot be instantiated with `new`.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • list.stream()

    Why this is correct

    Correct. The List interface provides the stream() method to obtain a sequential Stream<String>.

  • Stream.of(list)

    Why it's wrong here

    Incorrect. Stream.of(list) treats the list itself as a single element, producing a Stream<List<String>>, not Stream<String>.

  • Arrays.stream(list.toArray())

    Why it's wrong here

    Incorrect. Arrays.stream(list.toArray()) returns a Stream<Object> because toArray() returns Object[], not a Stream<String>. It is not a direct or type-safe way to obtain a stream from a List.

  • new Stream<>(list)

    Why it's wrong here

    Incorrect. Stream is an interface and cannot be instantiated with the new keyword.

  • list.parallelStream()

    Why this is correct

    Correct. The List interface provides the parallelStream() method to obtain a parallel Stream<String>.

About these practice questions

Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 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-829 exam.