mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
EnumSet is more efficient than HashSet
This commit is contained in:
parent
fe7c0ebfac
commit
444756839c
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user