Java Reference
In-Depth Information
Note that this solution isn't very efficient (all Strings are repeatedly concatenated, which creates
a new String object at each iteration). In the next chapter, you'll see a more efficient solution
that uses joining() as follows (which internally makes use of a StringBuilder):
String traderStr =
transactions.stream()
.map(transaction -> transaction.getTrader().getName())
.distinct()
.sorted()
.collect(joining());
Listing 5.5. Are any traders based in Milan?
Listing 5.6. Print all transactions' values from the traders living in
Cambridge
Listing 5.7. What's the highest value of all the transactions?
 
Search WWH ::




Custom Search