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

Added getSum methods to hand class

parent ded8afc0
No related branches found
No related tags found
1 merge request!3Added HandOfCard class to
......@@ -2,6 +2,7 @@ package edu.ntnu.stud.cardgame;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class HandOfCards {
private final List<PlayingCard> hand;
......@@ -17,4 +18,10 @@ public class HandOfCards {
public void addCard(PlayingCard card) {
hand.add(card);
}
public int getSum() {
return hand.stream().
mapToInt(PlayingCard::getFace).
sum();
}
}
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