class CollectionUtil {

    public static <T> Collection<List<T>> split(Collection<T> collection, final int subsetSize)
    {
        if(collection == null || subsetSize < 1)
            return null;

        AtomicInteger subsetCounter = new AtomicInteger();
        return collection.stream().collect(Collectors.groupingBy(it -> subsetCounter.getAndIncrement() / subsetSize)).values();
    }

}