summaryrefslogtreecommitdiffhomepage
path: root/app/src
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
commitc55441332749d914d48b2aae67635adf077bfd5a (patch)
tree69e9ef44701283394f2553d63460e04a14979fdb /app/src
parentf8c5f238ea8696e049c4de8092e9d3363e17fd1a (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. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-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) {