Code: Select all
class Book {
double price;
String title;
public double getPrice(){....}
//constructors and setters
}
Code: Select all
double d = books.stream().flatMap(bs -> bs.stream()).map(book -> book.getPrice()).sum();
Code: Select all
cannot find symbol
symbol: method sum()
location: interface Stream<Double>
I knew that autoboxing was expensive in stream, but I need help explain why this happens.