code: public static final <T> List<List<T>> split(List<T> list, Predicate<T> predicate)
      {
          if (list.isEmpty())
          {
              return Collections.EMPTY_LIST;
          }
          List<List<T>> lists = new ArrayList<>();
          boolean b = predicate.test(list.get(0));
          int len = list.size();
          int start = 0;
          for (int ii=1;ii<len;ii++)
          {
              boolean t = predicate.test(list.get(ii));
              if (b != t)
              {
                  lists.add(list.subList(start, ii));
                  start = ii;
                  b = t;
              }
          }
          lists.add(list.subList(start, len));
          return lists;
      }
docs: Splits list into several sub-lists according to predicate.
  @param <T>
  @param list
  @param predicate
  @return