Add mentions for v2 group chats.

This commit is contained in:
Cody Henthorne
2020-08-05 16:45:52 -04:00
committed by Greyson Parrelli
parent 0bb9c1d650
commit b2d4c5d14b
90 changed files with 2279 additions and 372 deletions

View File

@@ -180,4 +180,21 @@ public final class StringUtil {
.appendCodePoint(Bidi.PDI)
.toString();
}
/**
* Trims a {@link CharSequence} of starting and trailing whitespace. Behavior matches
* {@link String#trim()} to preserve expectations around results.
*/
public static CharSequence trimSequence(CharSequence text) {
int length = text.length();
int startIndex = 0;
while ((startIndex < length) && (text.charAt(startIndex) <= ' ')) {
startIndex++;
}
while ((startIndex < length) && (text.charAt(length - 1) <= ' ')) {
length--;
}
return (startIndex > 0 || length < text.length()) ? text.subSequence(startIndex, length) : text;
}
}

View File

@@ -176,6 +176,10 @@ public class Util {
return value != null ? value : "";
}
public static @NonNull CharSequence emptyIfNull(@Nullable CharSequence value) {
return value != null ? value : "";
}
public static <E> List<List<E>> chunk(@NonNull List<E> list, int chunkSize) {
List<List<E>> chunks = new ArrayList<>(list.size() / chunkSize);