private static <T> @NotNull List<List<T>> groupSublistRuns(@NotNull List<T> list,
                                                             @NotNull BiPredicate<? super T, ? super T> equality) {
    if (list.isEmpty()) {
      return Collections.emptyList();
    }

    List<List<T>> result = new ArrayList<>();
    int lastIndex = 0;
    for (int i = 0, size = list.size(); i < size; i++) {
      if (i == size - 1 || !equality.test(list.get(i), list.get(i + 1))) {
        result.add(list.subList(lastIndex, i + 1));
        lastIndex = i + 1;
      }
    }
    return result;
  }
private static <T> @NotNull List<List<T>> groupSublistRuns(@NotNull List<T> list,
                                                             @NotNull BiPredicate<? super T, ? super T> equality)