command completion

This commit is contained in:
Sen 2025-03-17 18:21:41 +01:00
parent 0839beb98e
commit a8f6af2b37
11 changed files with 400 additions and 347 deletions

View file

@ -245,6 +245,18 @@ int utf_len(const char *str) {
return buildLines("\n", func, elems);
}
public static <T> String buildLines(String separator, Iterable<T> elems) {
return buildLines(separator, new Function<T, String>() {
public String apply(T t) {
return String.valueOf(t);
}
}, elems);
}
public static <T> String buildLines(Iterable<T> elems) {
return buildLines("\n", elems);
}
public static <T> String buildLines(String separator, Function<T, String> func, T ... elems) {
StringBuilder sb = new StringBuilder();
for(T elem : elems) {
@ -258,4 +270,16 @@ int utf_len(const char *str) {
public static <T> String buildLines(Function<T, String> func, T ... elems) {
return buildLines("\n", func, elems);
}
public static <T> String buildLines(String separator, T ... elems) {
return buildLines(separator, new Function<T, String>() {
public String apply(T t) {
return String.valueOf(t);
}
}, elems);
}
public static <T> String buildLines(T ... elems) {
return buildLines("\n", elems);
}
}