aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-03-13 17:42:17 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-03-13 17:42:17 +0100
commit0af8ee341c315481930054fd5930b60868ea6fea (patch)
treea742df8d930fec54010f808202685d7a0f070e99
parent1153e6120d5e04b6ccb30ec3eae8a6ae0acc7bc9 (diff)
simplified getUsers(max) code
-rw-r--r--src/main/java/eu/siacs/conversations/entities/MucOptions.java13
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 4fe26743e..db27810fc 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() {