flip some loops to using java internals instead (per intellij)

This commit is contained in:
Jesse Vincent 2010-12-01 03:04:57 +00:00
parent 5485d0faf1
commit cead5c7060
4 changed files with 11 additions and 52 deletions

View file

@ -27,11 +27,7 @@ import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.mail.Flag;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class Accounts extends K9ListActivity implements OnItemClickListener, OnClickListener
@ -427,10 +423,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
newAccounts.add(unreadAccount);
}
for (BaseAccount account : accounts)
{
newAccounts.add(account);
}
newAccounts.addAll(Arrays.asList(accounts));
mAdapter = new AccountsAdapter(newAccounts.toArray(EMPTY_BASE_ACCOUNT_ARRAY));
getListView().setAdapter(mAdapter);
@ -1084,14 +1077,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
return set1;
}
Set<Flag> flags = new HashSet<Flag>();
for (Flag flag : set1)
{
flags.add(flag);
}
for (Flag flag : set2)
{
flags.add(flag);
}
flags.addAll(Arrays.asList(set1));
flags.addAll(Arrays.asList(set2));
return flags.toArray(EMPTY_FLAG_ARRAY);
}

View file

@ -3,17 +3,7 @@ package com.fsck.k9.controller;
import java.io.CharArrayWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
@ -761,10 +751,7 @@ public class MessagingController implements Runnable
final Set<String> accountUuidsSet = new HashSet<String>();
if (accountUuids != null)
{
for (String accountUuid : accountUuids)
{
accountUuidsSet.add(accountUuid);
}
accountUuidsSet.addAll(Arrays.asList(accountUuids));
}
final Preferences prefs = Preferences.getPreferences(mApplication.getApplicationContext());
Account[] accounts = prefs.getAccounts();
@ -833,10 +820,7 @@ public class MessagingController implements Runnable
if (folderNames != null)
{
folderNameSet = new HashSet<String>();
for (String folderName : folderNames)
{
folderNameSet.add(folderName);
}
folderNameSet.addAll(Arrays.asList(folderNames));
}
for (Folder folder : folders)
{
@ -2406,10 +2390,7 @@ public class MessagingController implements Runnable
command.arguments[0] = srcFolder;
command.arguments[1] = destFolder;
command.arguments[2] = Boolean.toString(isCopy);
for (int i = 0; i < uids.length; i++)
{
command.arguments[3 + i] = uids[i];
}
System.arraycopy(uids, 0, command.arguments, 3, uids.length);
queuePendingCommand(account, command);
}
/**
@ -2521,10 +2502,7 @@ public class MessagingController implements Runnable
command.arguments[0] = folderName;
command.arguments[1] = newState;
command.arguments[2] = flag;
for (int i = 0; i < uids.length; i++)
{
command.arguments[3 + i] = uids[i];
}
System.arraycopy(uids, 0, command.arguments, 3, uids.length);
queuePendingCommand(account, command);
processPendingCommands(account);
}

View file

@ -41,10 +41,7 @@ public class LineWrapOutputStream extends FilterOutputStream
if (lineLength > 0)
{
// Copy rest of the buffer to the front
for (int i = 0; i < lineLength; i++)
{
buffer[i] = buffer[endOfLastWord + i];
}
System.arraycopy(buffer, endOfLastWord + 0, buffer, 0, lineLength);
}
endOfLastWord = 0;
}

View file

@ -3181,10 +3181,7 @@ public class ImapStore extends Store
messageArray = getMessages(flagSyncMsgSeqs, true, null);
List<Message> messages = new ArrayList<Message>();
for (Message message : messageArray)
{
messages.add(message);
}
messages.addAll(Arrays.asList(messageArray));
pushMessages(messages, false);
}