Splits list into several sub-lists according to predicate.
@param <T>
@param list
@param predicate
@return
9670
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;
    }
41408
public static <T> T[] toArray(List<T> list) {
        T[] toR = (T[]) Array.newInstance(list.get(0).getClass(), list.size());
        for (int i = 0; i < list.size(); i++) {
            toR[i] = list.get(i);
        }
        return toR;
    }
1134714
public static <T> Map<Boolean, List<T>> toMapPartition( Stream<T> stream, Predicate<T> predicate ) {
        return stream.collect(Collectors.partitioningBy(predicate));
    }
787940
public static List<String> splitToList(final String value) {
        if (!StringUtils.isEmpty(value)) {
            return COMMA_SPLITTER.splitToList(value);
        }
        return Collections.<String> emptyList();
    }
401074
protected List<String> trim(List<String> list) {
        if (list == null || list.size() == 0)
            return list;

        List<String> result = new ArrayList<String>();
        for (String s : list) {
            s = trim(s);

            if (s == null || s.length() == 0)
                continue;

            result.add(s);
        }

        return result;
    }
181888
public static <T,W> List<W> listSecond(List<Pair<T, W>> list) {
        ArrayList<W> ts = new ArrayList<W>();
        for (Pair<T, W> twPair : list) {
            ts.add(twPair.getSecond());
        }
        return ts;
    }
1062157
public static String join(List<String> list, String separator) {
        if (list == null) {
            return null;
        }

        return join(list.toArray(), separator, 0, list.size());
    }
651879
public static <T> List<List<T>> split(final List<T> list, final int count) {
    List<List<T>> subIdLists = CollectUtils.newArrayList();
    if (list.size() < count) {
      subIdLists.add(list);
    } else {
      int i = 0;
      while (i < list.size()) {
        int end = i + count;
        if (end > list.size()) {
          end = list.size();
        }
        subIdLists.add(list.subList(i, end));
        i += count;
      }
    }
    return subIdLists;
  }
829629
public static <T> C.List<T> toList(Iterable<? extends T> iterable) {
        if (iterable instanceof Collection) {
            return toList((Collection<T>) iterable);
        }
        ListBuilder<T> lb = new ListBuilder<T>(10);
        for (T t : iterable) {
            lb.add(t);
        }
        return lb.toList();
    }
123146
public static <T> List<T> removeTypes(final List<T> list, final List<Class<? extends T>> filter) {
        final Iterator it = list.iterator();
        while (it.hasNext()) {
            final Class type = it.next().getClass();
            if (filter.contains(type)) {
                it.remove();
            }
        }
        return list;
    }
604550
public static <T> List<T> sort(List<T> list, Comparator<? super T> c) {
		Collections.sort(list, c);
		return list;
	}
64046
public static <T> List<T> slice(List<T> list, Integer start, Integer stop) {
        int size = list.size();

        if (start == null) {
            start = 0;
        } else if (start < 0) {
            start = size + start;
        }

        if (stop == null) {
            stop = size;
        } else if (stop < 0) {
            stop = size + stop;
        }

        if (start >= size || stop <= 0 || start >= stop) {
            return Collections.emptyList();
        }

        start = Math.max(0, start);
        stop = Math.min(size, stop);

        return list.subList(start, stop);
    }
10705
public static List<String> splitAsList(String source, char delimiter) {

        return splitAsList(source, delimiter, false);
    }
1235082
public static <T> List<T> subList(List<T> list, int pageSize, int pageNo) {
        pageSize = (pageSize <= 0 ? 10 : pageSize);
        pageNo = (pageNo <= 0 ? 1 : pageNo);
        int begin = (pageSize * (pageNo - 1) > list.size() ? list.size() : pageSize * (pageNo - 1));
        int end = (pageSize * pageNo > list.size() ? list.size() : pageSize * pageNo);
        return new ArrayList<T>(list.subList(begin, end));
    }
340364
@Override
    public ListT<W,T> takeUntil(final Predicate<? super T> p) {

        return (ListT<W,T>) FoldableTransformerSeq.super.takeUntil(p);
    }
1097984
public static <T> Predicate<T> contains(final Iterable<T> iterable) {
        return new Predicate<T>() {
            @Override
            public boolean test(final T testValue) {
                return Iterables.contains(iterable, testValue);
            }
        };
    }
469523
public static <T> List<T> toList(BaseStream<T, ? extends BaseStream> stream) {
        return StreamSupport.stream(
                        Spliterators.spliteratorUnknownSize(stream.iterator(), Spliterator.ORDERED),
                false).collect(Collectors.<T>toList());
    }