View Mode
Q: 3
Given: public class Product { int id; int price; public Product (int id, int price) { this.id = id; this.price = price; } Public String toString () { return id + “:” + price;) } and the code fragment: List products = new ArrayList (Arrays.asList(new Product(1, 10), new Product (2, 30), new Product (3, 20)); Product p = products.stream().reduce(new Product (4, 0), (p1, p2) -> { p1.price+=p2.price; return new Product (p1.id, p1.price);}); products.add(p); products.stream().parallel() .reduce((p1, p2) - > p1.price > p2.price ? p1 : p2) .ifPresent(System.out: :println); What is the result?
Options
Question 3 of 25

Premium Access Includes

  • Quiz Simulator
  • Exam Mode
  • Progress Tracking
  • Question Saving
  • Flash Cards
  • Drag & Drops
  • 3 Months Access
  • PDF Downloads
Get Premium Access
Scroll to Top

FLASH OFFER

Days
Hours
Minutes
Seconds

avail 10% DISCOUNT on YOUR PURCHASE