mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
use isEmpty instead of size() == 0 for clarify
This commit is contained in:
parent
02c0b5f2a3
commit
d38f21265d
@ -39,7 +39,7 @@ public class Preferences {
|
||||
private Preferences(Context context) {
|
||||
mStorage = Storage.getStorage(context);
|
||||
mContext = context;
|
||||
if (mStorage.size() == 0) {
|
||||
if (mStorage.isEmpty()) {
|
||||
Log.i(K9.LOG_TAG, "Preferences storage is zero-size, importing from Android-style preferences");
|
||||
Editor editor = mStorage.edit();
|
||||
editor.copy(context.getSharedPreferences("AndroidMail.Main", Context.MODE_PRIVATE));
|
||||
|
@ -1056,7 +1056,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
|
||||
private boolean addRecipients(TextView view, List<String> recipients) {
|
||||
if (recipients == null || recipients.size() == 0) {
|
||||
if (recipients == null || recipients.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class EmailProviderCache {
|
||||
Map<String, String> map = mMessageCache.get(messageId);
|
||||
if (map != null) {
|
||||
map.remove(columnName);
|
||||
if (map.size() == 0) {
|
||||
if (map.isEmpty()) {
|
||||
mMessageCache.remove(messageId);
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class EmailProviderCache {
|
||||
Map<String, String> map = mThreadCache.get(threadRootId);
|
||||
if (map != null) {
|
||||
map.remove(columnName);
|
||||
if (map.size() == 0) {
|
||||
if (map.isEmpty()) {
|
||||
mThreadCache.remove(threadRootId);
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class EmailProviderCacheCursor extends CursorWrapper {
|
||||
|
||||
@Override
|
||||
public boolean moveToPosition(int position) {
|
||||
if (mHiddenRows.size() == 0) {
|
||||
if (mHiddenRows.isEmpty()) {
|
||||
return super.moveToPosition(position);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public class EmailProviderCacheCursor extends CursorWrapper {
|
||||
|
||||
@Override
|
||||
public int getPosition() {
|
||||
if (mHiddenRows.size() == 0) {
|
||||
if (mHiddenRows.isEmpty()) {
|
||||
return super.getPosition();
|
||||
}
|
||||
|
||||
|
@ -1814,7 +1814,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
}
|
||||
|
||||
List<String> folderNames = mSearch.getFolderNames();
|
||||
return (folderNames.size() == 0 || folderNames.contains(folder));
|
||||
return (folderNames.isEmpty() || folderNames.contains(folder));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2362,7 +2362,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
}
|
||||
|
||||
private void setFlagForSelected(final Flag flag, final boolean newState) {
|
||||
if (mSelected.size() == 0) {
|
||||
if (mSelected.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2586,7 +2586,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
private boolean checkCopyOrMovePossible(final List<Message> messages,
|
||||
final FolderOperation operation) {
|
||||
|
||||
if (messages.size() == 0) {
|
||||
if (messages.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3515,7 +3515,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
}
|
||||
|
||||
private void cleanupSelected(Cursor cursor) {
|
||||
if (mSelected.size() == 0) {
|
||||
if (mSelected.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3534,7 +3534,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
* Starts or finishes the action mode when necessary.
|
||||
*/
|
||||
private void resetActionMode() {
|
||||
if (mSelected.size() == 0) {
|
||||
if (mSelected.isEmpty()) {
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ public class Contacts {
|
||||
}
|
||||
|
||||
// Return 'null' if no email addresses have been found
|
||||
if (email.size() == 0) {
|
||||
if (email.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ public class ImapStore extends Store {
|
||||
throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder");
|
||||
}
|
||||
|
||||
if (messages.size() == 0) {
|
||||
if (messages.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1193,7 +1193,7 @@ public class ImapStore extends Store {
|
||||
|
||||
@Override
|
||||
public Map<String, String> moveMessages(List<? extends Message> messages, Folder folder) throws MessagingException {
|
||||
if (messages.size() == 0)
|
||||
if (messages.isEmpty())
|
||||
return null;
|
||||
Map<String, String> uidMap = copyMessages(messages, folder);
|
||||
setFlags(messages, Collections.singleton(Flag.DELETED), true);
|
||||
@ -1202,7 +1202,7 @@ public class ImapStore extends Store {
|
||||
|
||||
@Override
|
||||
public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException {
|
||||
if (messages.size() == 0)
|
||||
if (messages.isEmpty())
|
||||
return;
|
||||
|
||||
if (trashFolderName == null || getName().equalsIgnoreCase(trashFolderName)) {
|
||||
@ -1435,7 +1435,7 @@ public class ImapStore extends Store {
|
||||
@Override
|
||||
public void fetch(List<? extends Message> messages, FetchProfile fp, MessageRetrievalListener listener)
|
||||
throws MessagingException {
|
||||
if (messages == null || messages.size() == 0) {
|
||||
if (messages == null || messages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
checkOpen(); //only need READ access
|
||||
@ -2036,7 +2036,7 @@ public class ImapStore extends Store {
|
||||
* with the behavior of other similar methods (copyMessages, moveMessages) which
|
||||
* return null.
|
||||
*/
|
||||
return (uidMap.size() == 0) ? null : uidMap;
|
||||
return (uidMap.isEmpty()) ? null : uidMap;
|
||||
} catch (IOException ioe) {
|
||||
throw ioExceptionHandler(mConnection, ioe);
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ public class Pop3Store extends Store {
|
||||
@Override
|
||||
public void fetch(List<? extends Message> messages, FetchProfile fp, MessageRetrievalListener listener)
|
||||
throws MessagingException {
|
||||
if (messages == null || messages.size() == 0) {
|
||||
if (messages == null || messages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<String> uids = new ArrayList<String>();
|
||||
|
@ -1501,7 +1501,7 @@ public class WebDavStore extends Store {
|
||||
public void fetch(List<? extends Message> messages, FetchProfile fp, MessageRetrievalListener listener)
|
||||
throws MessagingException {
|
||||
if (messages == null ||
|
||||
messages.size() == 0) {
|
||||
messages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1654,7 +1654,7 @@ public class WebDavStore extends Store {
|
||||
String[] uids;
|
||||
|
||||
if (startMessages == null ||
|
||||
startMessages.size() == 0) {
|
||||
startMessages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1724,7 +1724,7 @@ public class WebDavStore extends Store {
|
||||
List<Message> messages = new ArrayList<Message>(10);
|
||||
|
||||
if (startMessages == null ||
|
||||
startMessages.size() == 0) {
|
||||
startMessages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class Settings {
|
||||
SortedMap<Integer, SettingsDescription> headMap = versions.headMap(version + 1);
|
||||
|
||||
// Skip this setting if it was introduced after 'version'
|
||||
if (headMap.size() == 0) {
|
||||
if (headMap.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -290,8 +290,8 @@ public class Storage implements SharedPreferences {
|
||||
}
|
||||
}
|
||||
|
||||
public long size() {
|
||||
return storage.size();
|
||||
public boolean isEmpty() {
|
||||
return storage.isEmpty();
|
||||
}
|
||||
|
||||
//@Override
|
||||
|
@ -328,7 +328,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
*/
|
||||
@Override
|
||||
public String[] getAccountUuids() {
|
||||
if (mAccountUuids.size() == 0) {
|
||||
if (mAccountUuids.isEmpty()) {
|
||||
return new String[] { SearchSpecification.ALL_ACCOUNTS };
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
* @return {@code true} if all accounts should be searched.
|
||||
*/
|
||||
public boolean searchAllAccounts() {
|
||||
return (mAccountUuids.size() == 0);
|
||||
return (mAccountUuids.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user