From 8bb6eb146b09e1b088a542c5406dd8d08c54f599 Mon Sep 17 00:00:00 2001 From: Fiouz Date: Sun, 3 Oct 2010 08:28:56 +0000 Subject: [PATCH] Optimizations: - Don't instantiate an empty Address array just to throw it away (less gabarge collection) - Use a StringBuilder rather than a StringBuffer (faster as it isn't synchronized) --- src/com/fsck/k9/mail/Address.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/mail/Address.java b/src/com/fsck/k9/mail/Address.java index 55ce55917..d7068edb3 100644 --- a/src/com/fsck/k9/mail/Address.java +++ b/src/com/fsck/k9/mail/Address.java @@ -388,7 +388,7 @@ public class Address addresses.add(new Address(address, personal)); pairStartIndex = pairEndIndex + 2; } - return addresses.toArray(new Address[] { }); + return addresses.toArray(new Address[addresses.size()]); } /** @@ -405,7 +405,7 @@ public class Address { return null; } - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0, count = addresses.length; i < count; i++) { Address address = addresses[i];