对集合按照指定长度分段，每一个段为单独的集合，返回这个集合的列表

@param <T> 集合元素类型
@param collection 集合
@param size 每个段的长度
@return 分段列表
329128
public static <T> List<List<T>> split(Collection<T> collection, int size) {
		final List<List<T>> result = new ArrayList<>();

		ArrayList<T> subList = new ArrayList<>(size);
		for (T t : collection) {
			if (subList.size() >= size) {
				result.add(subList);
				subList = new ArrayList<>(size);
			}
			subList.add(t);
		}
		result.add(subList);
		return result;
	}
862153
public static <T extends CharSequence> Collection<T> removeEmpty(Collection<T> collection) {
		return filter(collection, new Filter<T>() {
			@Override
			public boolean accept(T t) {
				return false == StrUtil.isEmpty(t);
			}
		});
	}
613280
public function size($collection=null) {
    list($collection) = self::_wrapArgs(func_get_args(), 1);
    
    $collection = self::_collection($collection);
    
    return self::_wrap(count((array) $collection));
  }
1127177
public final void setToSize(int size) {
    
    Object newMap[] = new Object[size];
    
    System.arraycopy(m_map, 0, newMap, 0, m_firstFree);
    m_mapSize = size;

    m_map = newMap;
    
  }
177266
public static List<boolean[]> split(final boolean[] a, final int size) {
        if (size < 1) {
            throw new IllegalArgumentException("The parameter 'size' can not be zero or less than zero");
        }

        if (N.isNullOrEmpty(a)) {
            return new ArrayList<>();
        }

        final int len = a.length;
        final List<boolean[]> res = new ArrayList<>(len % size == 0 ? len / size : (len / size) + 1);

        for (int from = 0, toIndex = a.length; from < toIndex; from += size) {
            res.add(copyOfRange(a, from, from <= toIndex - size ? from + size : toIndex));
        }

        return res;
    }
550711
public static <T> Set<T> getSet(Collection<T> collection) {
    Set<T> set = new LinkedHashSet<T>();
    set.addAll(collection);

    return set;
  }
506140
public Criteria size(int size) {
        this.criteriaType = RelationalOperator.SIZE;
        this.right = ValueNode.toValueNode(size);
        return this;
    }
1317320
public static int[] toIntArray(Collection<Integer> collection) {
        int[] collectionArray = new int[collection.size()];
        int index = 0;
        for (Integer item : collection) {
            collectionArray[index++] = item;
        }
        return collectionArray;
    }
158824
@Override
    public <C extends PersistentCollection<? super T>> ListT<W,C> grouped(final int size, final Supplier<C> supplier) {

        return (ListT<W,C>) FoldableTransformerSeq.super.grouped(size, supplier);
    }
645811
function size(collection) {
  var x, i = 0;

  if ('object' === type(collection)) {
    for (x in collection) i++;
    return i;
  }

  return +collection.length;
}
552040
private static <E> List<E> getBatchList(Integer index, int batchSize, Collection<E> collection) {
        List<E> list = null;
        if (collection instanceof List) {
            list = (List<E>) collection;
        } else {
            list = new ArrayList<E>(collection);
        }

        if (index == list.size() / batchSize) {
            return list.subList(index * batchSize, list.size());
        } else {
            return list.subList(index * batchSize, (index + 1) * batchSize);
        }
    }
90139
public static <T> T[] toArray(final Collection<T> collection) {

        T next = getFirstNotNullValue(collection);
        if (next != null) {
            Object[] objects = collection.toArray();
            @SuppressWarnings("unchecked")
            T[] convertedObjects = (T[]) Array.newInstance(next.getClass(), objects.length);
            System.arraycopy(objects, 0, convertedObjects, 0, objects.length);
            return convertedObjects;
        } else {
            return null;
        }
    }
1120572
public static <E> Matcher<Iterable<E>> hasSize(final int size) {
        checkArgument(size >= 0, "Size cannot be negative");

        return new IsIterableWithSize(size);
    }
1340420
public static int sizeOf(Iterable<?> iterable)
    {
        if (iterable instanceof Collection)
        {
            return ((Collection<?>) iterable).size();
        }
        if (iterable instanceof RichIterable)
        {
            return ((RichIterable<?>) iterable).size();
        }
        return Iterate.count(iterable, Predicates.alwaysTrue());
    }
435693
public static int[] toArray(final Collection<Integer> collection) {
        Objects.requireNonNull(collection);
        
        final int size = collection.size();
        final int[] array = new int[size];
        
        int i=0;
        for(Integer value : collection) {
            array[i] = value;
            i++;
        }
        
        return array;
    }
229311
public static <T, R> Map<R, List<T>> groupBy(Collection<T> collection,
            Function<T, R> classifier) {
        return groupBy(collection.stream(), classifier);
    }
1241085
public static double[] asDoubleArray(Collection collection) {
        double[] result = new double[collection.size()];
        int i = 0;
        for (Object c : collection) {
            result[i++] = asDouble(c);
        }
        return result;
    }