improved iterating over hashmap
This commit is contained in:
parent
2b14ad51ec
commit
690ee4988e
|
@ -926,14 +926,10 @@ public class XmppConnection implements Runnable {
|
||||||
|
|
||||||
public List<String> findDiscoItemsByFeature(String feature) {
|
public List<String> findDiscoItemsByFeature(String feature) {
|
||||||
List<String> items = new ArrayList<String>();
|
List<String> items = new ArrayList<String>();
|
||||||
Iterator<Entry<String, List<String>>> it = this.disco.entrySet()
|
for (Entry<String, List<String>> cursor : disco.entrySet()) {
|
||||||
.iterator();
|
if (cursor.getValue().contains(feature)) {
|
||||||
while (it.hasNext()) {
|
items.add(cursor.getKey());
|
||||||
Entry<String, List<String>> pairs = it.next();
|
|
||||||
if (pairs.getValue().contains(feature)) {
|
|
||||||
items.add(pairs.getKey());
|
|
||||||
}
|
}
|
||||||
it.remove();
|
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
|
@ -507,10 +507,8 @@ public class JingleConnection {
|
||||||
|
|
||||||
private JingleSocks5Transport chooseConnection() {
|
private JingleSocks5Transport chooseConnection() {
|
||||||
JingleSocks5Transport connection = null;
|
JingleSocks5Transport connection = null;
|
||||||
Iterator<Entry<String, JingleSocks5Transport>> it = this.connections.entrySet().iterator();
|
for (Entry<String, JingleSocks5Transport> cursor : connections.entrySet()) {
|
||||||
while (it.hasNext()) {
|
JingleSocks5Transport currentConnection = cursor.getValue();
|
||||||
Entry<String, JingleSocks5Transport> pairs = it.next();
|
|
||||||
JingleSocks5Transport currentConnection = pairs.getValue();
|
|
||||||
//Log.d("xmppService","comparing candidate: "+currentConnection.getCandidate().toString());
|
//Log.d("xmppService","comparing candidate: "+currentConnection.getCandidate().toString());
|
||||||
if (currentConnection.isEstablished()&&(currentConnection.getCandidate().isUsedByCounterpart()||(!currentConnection.getCandidate().isOurs()))) {
|
if (currentConnection.isEstablished()&&(currentConnection.getCandidate().isUsedByCounterpart()||(!currentConnection.getCandidate().isOurs()))) {
|
||||||
//Log.d("xmppService","is usable");
|
//Log.d("xmppService","is usable");
|
||||||
|
@ -533,7 +531,6 @@ public class JingleConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.remove();
|
|
||||||
}
|
}
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue