From 7a16b8ff95c39a3f46c3b8d68352ff4919b73f3c Mon Sep 17 00:00:00 2001 From: Alex Wenckus Date: Wed, 29 Nov 2006 23:32:04 +0000 Subject: [PATCH] 1.5 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6262 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/Roster.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/source/org/jivesoftware/smack/Roster.java b/source/org/jivesoftware/smack/Roster.java index 26d457647..8680cfc61 100644 --- a/source/org/jivesoftware/smack/Roster.java +++ b/source/org/jivesoftware/smack/Roster.java @@ -432,20 +432,13 @@ public class Roster implements ConnectionListener { else { // Find the resource with the highest priority // Might be changed to use the resource with the highest availability instead. - Iterator it = userPresences.keySet().iterator(); - Presence p; Presence presence = null; - while (it.hasNext()) { - p = userPresences.get(it.next()); - if (presence == null) { + for (String resource : userPresences.keySet()) { + Presence p = userPresences.get(resource); + if (presence == null || p.getPriority() > presence.getPriority()) { presence = p; } - else { - if (p.getPriority() > presence.getPriority()) { - presence = p; - } - } } return presence; }