|
|
|
|
|
by douche
3647 days ago
|
|
This is a place where local variable type inference really comes in handy for cutting down the noise of the type declarations. var descendingTransactionsByValue = comparing(Transaction::getValue).reversed();
var groceries = transactions.filter(t -> t.getType() == Transaction.GROCERY);
var sortedGroceries = groceries.sorted(descendingTransactionsByValue);
var transactionids = sortedGroceries.map(Transaction::getId).collect(toList());
is much easier to understand |
|
[1]: http://openjdk.java.net/jeps/286