1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

EnumSet is more efficient than HashSet

This commit is contained in:
Art O Cathain 2014-10-05 12:08:55 +01:00
parent fe7c0ebfac
commit 444756839c
2 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
@ -27,7 +28,7 @@ public abstract class Message implements Part, CompositeBody {
protected String mUid;
private Set<Flag> mFlags = new HashSet<Flag>();
private Set<Flag> mFlags = EnumSet.noneOf(Flag.class);
private Date mInternalDate;
@ -291,7 +292,7 @@ public abstract class Message implements Part, CompositeBody {
destination.mReference = mReference;
// mFlags contents can change during the object lifetime, so copy the Set
destination.mFlags = new HashSet<Flag>(mFlags);
destination.mFlags = EnumSet.copyOf(mFlags);
}
/**

View File

@ -30,6 +30,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Deque;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -116,7 +117,7 @@ public class ImapStore extends Store {
private static int FETCH_WINDOW_SIZE = 100;
private Set<Flag> mPermanentFlagsIndex = new HashSet<Flag>();
private Set<Flag> mPermanentFlagsIndex = EnumSet.noneOf(Flag.class);
private static final String CAPABILITY_IDLE = "IDLE";
private static final String CAPABILITY_AUTH_CRAM_MD5 = "AUTH=CRAM-MD5";