1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-02 14:02:17 -05:00

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)
This commit is contained in:
Fiouz 2010-10-03 08:28:56 +00:00
parent ef1d958092
commit 8bb6eb146b

View File

@ -388,7 +388,7 @@ public class Address
addresses.add(new Address(address, personal)); addresses.add(new Address(address, personal));
pairStartIndex = pairEndIndex + 2; pairStartIndex = pairEndIndex + 2;
} }
return addresses.toArray(new Address[] { }); return addresses.toArray(new Address[addresses.size()]);
} }
/** /**
@ -405,7 +405,7 @@ public class Address
{ {
return null; return null;
} }
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
for (int i = 0, count = addresses.length; i < count; i++) for (int i = 0, count = addresses.length; i < count; i++)
{ {
Address address = addresses[i]; Address address = addresses[i];