summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-02-10 17:02:29 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-02-10 17:04:34 +0100
commit5d9cc7a1739296f7bc379be99527460eca7a95d5 (patch)
tree69e9ef44701283394f2553d63460e04a14979fdb /app/src/main/java/com
parentbe4c52f6a3e1c87fb8f16c7eafc1beca0d8d36a4 (diff)
Attribute: remove need for android TextUtils
If this is to be JRE-only, then it doesn't make sense to rely on the android class, especially since this is so trivial to inline.
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/wireguard/config/Attribute.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/config/Attribute.java b/app/src/main/java/com/wireguard/config/Attribute.java
index 375acc42..1e9e25f0 100644
--- a/app/src/main/java/com/wireguard/config/Attribute.java
+++ b/app/src/main/java/com/wireguard/config/Attribute.java
@@ -5,8 +5,7 @@
package com.wireguard.config;
-import android.text.TextUtils;
-
+import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -25,7 +24,17 @@ public final class Attribute {
}
public static String join(final Iterable<?> values) {
- return TextUtils.join(", ", values);
+ final Iterator<?> it = values.iterator();
+ if (!it.hasNext()) {
+ return "";
+ }
+ final StringBuilder sb = new StringBuilder();
+ sb.append(it.next());
+ while (it.hasNext()) {
+ sb.append(", ");
+ sb.append(it.next());
+ }
+ return sb.toString();
}
public static Optional<Attribute> parse(final CharSequence line) {