simplified getUsers(max) code

This commit is contained in:
Daniel Gultsch 2016-03-13 17:42:17 +01:00
parent 1153e6120d
commit 0af8ee341c
1 changed files with 2 additions and 11 deletions

View File

@ -345,17 +345,8 @@ public class MucOptions {
} }
public List<User> getUsers(int max) { public List<User> getUsers(int max) {
ArrayList<User> users = new ArrayList<>(); ArrayList<User> users = getUsers();
int i = 1; return users.subList(0, Math.min(max, users.size()));
for(User user : this.users.values()) {
users.add(user);
if (i >= max) {
break;
} else {
++i;
}
}
return users;
} }
public int getUserCount() { public int getUserCount() {