Stream.min() and Stream.max()

The Streams API provides min() and max() methods—stream processing for finding the minimum or maximum value in the stream respectively.

Let's take an example in the context of the sample application we're testing. We will create a simple Java class called Product that stores the name and price of products returned by the search. We want to find the product that has the minimum price and the one that has the maximum price. Our product class will have two members, as shown in the following code:

class Product {    String name;    Double price;    public Product(String name, double price) {        this.name = name;        this.price = price;    }    public String getName() {        return name;    }    public Double getPrice() {        return price;    }}

Let's create ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.