Prevent too long IMAP commands

This commit is contained in:
M66B
2019-05-22 13:17:42 +02:00
parent 1d98fea2df
commit b20c12edd1
2 changed files with 28 additions and 17 deletions

View File

@@ -576,6 +576,13 @@ public class Helper {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false);
}
public static <T> List<List<T>> chunkList(List<T> list, int size) {
List<List<T>> result = new ArrayList<>(list.size() / size);
for (int i = 0; i < list.size(); i += size)
result.add(list.subList(i, i + size < list.size() ? i + size : list.size()));
return result;
}
static long[] toLongArray(List<Long> list) {
long[] result = new long[list.size()];
for (int i = 0; i < list.size(); i++)