From 0af8ee341c315481930054fd5930b60868ea6fea Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 13 Mar 2016 17:42:17 +0100 Subject: simplified getUsers(max) code --- .../java/eu/siacs/conversations/entities/MucOptions.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/entities/MucOptions.java') 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 getUsers(int max) { - ArrayList users = new ArrayList<>(); - int i = 1; - for(User user : this.users.values()) { - users.add(user); - if (i >= max) { - break; - } else { - ++i; - } - } - return users; + ArrayList users = getUsers(); + return users.subList(0, Math.min(max, users.size())); } public int getUserCount() { -- cgit v1.2.3