mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-13 14:48:04 -05:00
Use more efficient entrySet iterator instead of keySet + get()
The loop extracted keys from `remodeUidMap` and then called `remouteUidMap.get(...)` for every key. If both the key and the value needs to be iterated on, `Map.entrySet()` is a more efficient solution as it doesn't require O(n) Map lookups.
This commit is contained in:
parent
9413cf5c9d
commit
2f918c2307
@ -2220,13 +2220,14 @@ public class MessagingController implements Runnable {
|
||||
* upto speed with the remote UIDs of remote destionation folder.
|
||||
*/
|
||||
if (!localUidMap.isEmpty() && remoteUidMap != null && !remoteUidMap.isEmpty()) {
|
||||
Set<String> remoteSrcUids = remoteUidMap.keySet();
|
||||
Iterator<String> remoteSrcUidsIterator = remoteSrcUids.iterator();
|
||||
Set<Map.Entry<String, String>> remoteSrcEntries = remoteUidMap.entrySet();
|
||||
Iterator<Map.Entry<String, String>> remoteSrcEntriesIterator = remoteSrcEntries.iterator();
|
||||
|
||||
while (remoteSrcUidsIterator.hasNext()) {
|
||||
String remoteSrcUid = remoteSrcUidsIterator.next();
|
||||
while (remoteSrcEntriesIterator.hasNext()) {
|
||||
Map.Entry<String, String> entry = remoteSrcEntriesIterator.next();
|
||||
String remoteSrcUid = entry.getKey();
|
||||
String localDestUid = localUidMap.get(remoteSrcUid);
|
||||
String newUid = remoteUidMap.get(remoteSrcUid);
|
||||
String newUid = entry.getValue();
|
||||
|
||||
Message localDestMessage = localDestFolder.getMessage(localDestUid);
|
||||
if (localDestMessage != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user