aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-11 19:48:02 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-11 19:48:02 +0200
commit690ee4988eda2c23830f514d31302b2837bd04f4 (patch)
treee6f2b145ea1a145503331cbce01a9113735cc9b0 /src
parent2b14ad51ecbfccbed326b82f141d96fa2c5b268f (diff)
improved iterating over hashmap
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java10
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java7
2 files changed, 5 insertions, 12 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index b2829c6e..824750f1 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -926,14 +926,10 @@ public class XmppConnection implements Runnable {
public List<String> findDiscoItemsByFeature(String feature) {
List<String> items = new ArrayList<String>();
- Iterator<Entry<String, List<String>>> it = this.disco.entrySet()
- .iterator();
- while (it.hasNext()) {
- Entry<String, List<String>> pairs = it.next();
- if (pairs.getValue().contains(feature)) {
- items.add(pairs.getKey());
+ for (Entry<String, List<String>> cursor : disco.entrySet()) {
+ if (cursor.getValue().contains(feature)) {
+ items.add(cursor.getKey());
}
- it.remove();
}
return items;
}
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index 1f287194..7a867ef7 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -507,10 +507,8 @@ public class JingleConnection {
private JingleSocks5Transport chooseConnection() {
JingleSocks5Transport connection = null;
- Iterator<Entry<String, JingleSocks5Transport>> it = this.connections.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, JingleSocks5Transport> pairs = it.next();
- JingleSocks5Transport currentConnection = pairs.getValue();
+ for (Entry<String, JingleSocks5Transport> cursor : connections.entrySet()) {
+ JingleSocks5Transport currentConnection = cursor.getValue();
//Log.d("xmppService","comparing candidate: "+currentConnection.getCandidate().toString());
if (currentConnection.isEstablished()&&(currentConnection.getCandidate().isUsedByCounterpart()||(!currentConnection.getCandidate().isOurs()))) {
//Log.d("xmppService","is usable");
@@ -533,7 +531,6 @@ public class JingleConnection {
}
}
}
- it.remove();
}
return connection;
}