Courseiva
Working with Streams and Lambda ExpressionsmediumMultiple ChoiceObjective-mapped

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

A company needs to process a stream of orders and filter out orders that are not in the 'SHIPPED' status. Then they want to collect the order IDs into a list. Which of the following correctly uses lambda expressions to achieve this?

⚠ Common exam trap

Oracle often tests the distinction between using equals() vs == for string comparison in lambda expressions, and the correct order of stream operations (filter before map) to avoid type mismatches or logical errors.

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

orders.stream().filter(o -> o.getStatus().equals("SHIPPED")).map(Order::getId).collect(Collectors.toList())

It first filters the stream to include only orders with status 'SHIPPED' using a lambda expression that calls equals() on the status string, then maps each order to its ID using a method reference, and finally collects the IDs into a list. This correctly uses lambda expressions and the Stream API to achieve the requirement.

Answer analysis

Option-by-option breakdown

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

  • orders.stream().filter(o -> o.getStatus() != "SHIPPED").map(Order::getId).collect(Collectors.toList())

    Why it's wrong here

    Filters out SHIPPED orders instead of keeping them.

  • orders.stream().map(Order::getId).filter(id -> id.equals("SHIPPED")).collect(Collectors.toList())

    Why it's wrong here

    Filters IDs, but IDs are not status strings.

  • orders.stream().filter(Order::getStatus).map(o -> o.getId()).collect(Collectors.toList())

    Why it's wrong here

    filter expects a Predicate<Order>, but getStatus returns String, not boolean.

  • orders.stream().filter(o -> o.getStatus().equals("SHIPPED")).map(Order::getId).collect(Collectors.toList())

    Why this is correct

    Correctly filters SHIPPED orders and maps to IDs.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.