From c55441332749d914d48b2aae67635adf077bfd5a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 10 Feb 2020 17:02:29 +0100 Subject: [PATCH] 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 --- .../main/java/com/wireguard/config/Attribute.java | 15 ++++++++++++--- 1 file 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 parse(final CharSequence line) {