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>
This commit is contained in:
Jason A. Donenfeld 2020-02-10 17:02:29 +01:00
parent f8c5f238ea
commit c554413327

View File

@ -5,8 +5,7 @@
package com.wireguard.config; package com.wireguard.config;
import android.text.TextUtils; import java.util.Iterator;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -25,7 +24,17 @@ public final class Attribute {
} }
public static String join(final Iterable<?> values) { 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) { public static Optional<Attribute> parse(final CharSequence line) {