-
Notifications
You must be signed in to change notification settings - Fork 738
Expand file tree
/
Copy pathLadderGameResult.java
More file actions
38 lines (28 loc) · 892 Bytes
/
LadderGameResult.java
File metadata and controls
38 lines (28 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package nextstep.ladder.domain.laddergame;
import java.util.HashMap;
import java.util.Map;
public class LadderGameResult {
private final Map<String, String> ladderGameResult;
public LadderGameResult() {
this(new HashMap<>());
}
public LadderGameResult(Map<String, String> ladderGameResult) {
this.ladderGameResult = ladderGameResult;
}
public void add(String name, String result) {
ladderGameResult.put(name, result);
}
public String getResult(String name) {
return ladderGameResult.get(name);
}
public StringBuilder getResultAll() {
StringBuilder result = new StringBuilder();
ladderGameResult.forEach((key, value) -> {
result.append(key)
.append(" : ")
.append(value)
.append("\n");
});
return result;
}
}