mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-14 21:45:14 -05:00
Don't construct a listenerset clone if we don't need to.
danapple++ suggested the optimization
This commit is contained in:
parent
08581f6538
commit
ff62ae5c23
@ -359,11 +359,13 @@ public class MessagingController implements Runnable
|
|||||||
|
|
||||||
public Set<MessagingListener> getListeners(MessagingListener listener)
|
public Set<MessagingListener> getListeners(MessagingListener listener)
|
||||||
{
|
{
|
||||||
Set<MessagingListener> listeners = new CopyOnWriteArraySet<MessagingListener>(mListeners);
|
if (listener == null)
|
||||||
if (listener != null)
|
|
||||||
{
|
{
|
||||||
listeners.add(listener);
|
return mListeners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<MessagingListener> listeners = new CopyOnWriteArraySet<MessagingListener>(mListeners);
|
||||||
|
listeners.add(listener);
|
||||||
return listeners;
|
return listeners;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user