package com.demo.utils;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.demo.bean.EmployeeEntity;
/**
*
* 自定义集合工具类拓展常用方法
* @autho 董杨炀
* @time 2017-4-10 上午11:33:36
*/
public class CollectionUtils extends org.apache.commons.collections.CollectionUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(CollectionUtils.class);
private static final int DEFAULT_SIZE = 1000;
/**
*
* 拆分List为固定大小的多个集合
* 推荐使用
* 返回集合的size越小,此方法性能越高
* @param baseList
* @param size
* @return ArrayList
* @autho 董杨炀
* @time 2017-4-10 上午11:30:43
*/
@SuppressWarnings("unchecked")
public static List> fastSplitList(List baseList, int size) {
if (baseList == null || baseList.size() == 0) {
return null;
}
if (size <= 0) {
size = DEFAULT_SIZE;
}
int arrSize = baseList.size() % size == 0 ? baseList.size() / size : baseList.size() / size + 1;
List> resultList = new ArrayList>();
for (int i = 0; i < arrSize; i++) {
if (arrSize - 1 == i) {
resultList.add((List) new ArrayList