diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-03-13 17:42:17 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-03-13 17:42:17 +0100 |
commit | 0af8ee341c315481930054fd5930b60868ea6fea (patch) | |
tree | a742df8d930fec54010f808202685d7a0f070e99 | |
parent | 1153e6120d5e04b6ccb30ec3eae8a6ae0acc7bc9 (diff) |
simplified getUsers(max) code
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/MucOptions.java | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 4fe26743..db27810f 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -345,17 +345,8 @@ public class MucOptions { } public List<User> getUsers(int max) { - ArrayList<User> users = new ArrayList<>(); - int i = 1; - for(User user : this.users.values()) { - users.add(user); - if (i >= max) { - break; - } else { - ++i; - } - } - return users; + ArrayList<User> users = getUsers(); + return users.subList(0, Math.min(max, users.size())); } public int getUserCount() { |