Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47eb0fa2 authored by Andrew Gaul's avatar Andrew Gaul Committed by Andrew Gaul
Browse files

Prefer StringBuilder over StringBuffer

The former is unsynchronized and slightly faster.
parent 0619eaf7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ public class Account implements BaseAccount {
    }
    
    private String combineUuids(String[] uuids) {
        StringBuffer sb = new StringBuffer();
        StringBuilder sb = new StringBuilder();
        for (int i = 0, length = uuids.length; i < length; i++) {
            if (sb.length() > 0) {
                sb.append(',');
+2 −2
Original line number Diff line number Diff line
@@ -727,7 +727,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
    private boolean setRecipients(TextView view, List<String> recipients) {
        boolean recipientAdded = false;
        if (recipients != null) {
            StringBuffer addressList = new StringBuffer();
            StringBuilder addressList = new StringBuilder();
            for (String recipient : recipients) {
                addressList.append(recipient);
                addressList.append(", ");
@@ -1964,7 +1964,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
                    mInReplyTo = message.getMessageId();

                    if (message.getReferences() != null && message.getReferences().length > 0) {
                        StringBuffer buffy = new StringBuffer();
                        StringBuilder buffy = new StringBuilder();
                        for (int i = 0; i < message.getReferences().length; i++)
                            buffy.append(message.getReferences()[i]);

+2 −2
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
                }

                mProgressBar.setIndeterminate(false);
                StringBuffer chainInfo = new StringBuffer(100);
                StringBuilder chainInfo = new StringBuilder(100);
                MessageDigest sha1 = null;
                try {
                    sha1 = MessageDigest.getInstance("SHA-1");
@@ -265,7 +265,7 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
                        if (subjectAlternativeNames != null) {
                            // The list of SubjectAltNames may be very long
                            //TODO: localize this string
                            StringBuffer altNamesText = new StringBuffer("Subject has " + subjectAlternativeNames.size() + " alternative names\n");
                            StringBuilder altNamesText = new StringBuilder("Subject has " + subjectAlternativeNames.size() + " alternative names\n");

                            // we need these for matching
                            String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class Utility {

    public static String readInputStream(InputStream in, String encoding) throws IOException {
        InputStreamReader reader = new InputStreamReader(in, encoding);
        StringBuffer sb = new StringBuffer();
        StringBuilder sb = new StringBuilder();
        int count;
        char[] buf = new char[512];
        while ((count = reader.read(buf)) != -1) {
+2 −2
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ public class Address {
        if (addresses == null) {
            return null;
        }
        StringBuffer sb = new StringBuffer();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < addresses.length; i++) {
            sb.append(addresses[i].toString());
            if (i < addresses.length - 1) {
@@ -201,7 +201,7 @@ public class Address {
        if (addresses == null) {
            return null;
        }
        StringBuffer sb = new StringBuffer();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < addresses.length; i++) {
            sb.append(addresses[i].toEncodedString());
            if (i < addresses.length - 1) {
Loading