We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d7899c3 commit e4db572Copy full SHA for e4db572
src/main/java/com/rampatra/java8/Streams.java
@@ -123,10 +123,15 @@ public static Integer[] getAllTransValuesFromTradersInCambridge() {
123
}
124
125
public static int findHighestTransactionValue() {
126
+ return transactions.stream()
127
+ .mapToInt(Transaction::getValue)
128
+ .max().getAsInt();
129
+
130
+ /* this is another solution
131
return transactions.stream()
132
.map(Transaction::getValue)
133
.reduce((t1, t2) -> (t1 > t2) ? t1 : t2) // you can replace with .reduce(Integer::max)
- .get();
134
+ .get();*/
135
136
137
public static Transaction getSmallestTransaction() {
0 commit comments