Skip to content
Snippets Groups Projects
Commit 49c5db63 authored by Scott Langum Du Plessis's avatar Scott Langum Du Plessis
Browse files

Fixed syntax toi match concention of streams

parent a7526bbc
No related branches found
No related tags found
1 merge request!3Added HandOfCard class to
......@@ -20,22 +20,24 @@ public class HandOfCards {
}
public int getSum() {
return hand.stream().
mapToInt(PlayingCard::getFace).
sum();
return hand.stream()
.mapToInt(PlayingCard::getFace)
.sum();
}
public String findHearts() {
StringBuilder sb = new StringBuilder();
hand.stream().
map(PlayingCard::getAsString).
filter(s -> s.charAt(0) == 'H').
forEach(sb::append);
hand.stream()
.map(PlayingCard::getAsString)
.filter(s -> s.charAt(0) == 'H')
.forEach(sb::append);
if (sb.isEmpty()) {
return "No hearts";
}
return sb.toString();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment