Too Long; Didn't Read
Implementing a Java Stream Collector is a way to show a shopping cart on-screen. The checkout screen needs to show two different bits of information: the list of rows with the price for each row, i.e., the price per product times the quantity, and the overall price of the cart. We want to collect both rows and the price from a single stream. We can model it as a Java 16 record. We need a custom collector to show the cart's price and the total price.