-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathParticipantUsers.java
More file actions
36 lines (26 loc) · 884 Bytes
/
ParticipantUsers.java
File metadata and controls
36 lines (26 loc) · 884 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
package domain.user;
import dto.GameStartOption;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static util.RandomIntegerMaker.separateUserName;
public class ParticipantUsers {
private List<User> users;
public ParticipantUsers(GameStartOption gameStartOption) {
this.users = createUser(gameStartOption.getParticipants());
}
public List<User> getUsers() {
return users;
}
private List<User> createUser(String users) {
return separateUserName(users).stream()
.map(u -> new User(u))
.collect(Collectors.toList());
}
public int getUserCharMaxNum() {
List<Integer> lengths = users.stream()
.map(u -> u.getName().length())
.collect(Collectors.toList());
return Collections.max(lengths);
}
}