From 9c44837d0c814dcb7fb006bbf5db138af7d5780e Mon Sep 17 00:00:00 2001 From: Nikola Trubitsyn Date: Tue, 26 Dec 2017 01:44:21 +0300 Subject: [PATCH] Use StringBuilder in String.times() Has better performance than StringBuffer --- .../com/simplemobiletools/contacts/overloads/String.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/overloads/String.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/overloads/String.kt index 3391c7de..df382fba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/overloads/String.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/overloads/String.kt @@ -1,9 +1,9 @@ package com.simplemobiletools.contacts.overloads operator fun String.times(x: Int): String { - val stringBuffer = StringBuffer() + val sb = StringBuilder() for (i in 1..x) { - stringBuffer.append(this) + sb.append(this) } - return stringBuffer.toString() + return sb.toString() }