//每个sheet显示多少条记录数
private static final int perSheetNum=3;
private static Map splitList(List accountSettlementDetail,int perSheetNum){
Map map=new HashMap();
if(accountSettlementDetail!=null && accountSettlementDetail.size()>perSheetNum)
{
//共有sheet数
int sheetNum=accountSettlementDetail.size()/perSheetNum;
int mod= accountSettlementDetail.size()%perSheetNum;
if(mod>0)sheetNum++;
for(int i=1;i<=sheetNum;i++){
int fromIndex=(i-1)*perSheetNum;
int toIndex=0;
if(i==sheetNum){
toIndex=accountSettlementDetail.size();
}else{
toIndex=i*perSheetNum;
}
System.out.println("toIndex:"+toIndex);
//
List pageList=accountSettlementDetail.subList(fromIndex, toIndex);
map.put("key:"+i, pageList);
}
}else{
map.put("accountSettlementDetail", accountSettlementDetail);
}
return map;
}
public static void main(String args[]){
List list=new ArrayList();
list.add("111111");
list.add("1111112");
list.add("1111113");
list.add("1111114");
list.add("1111115");
list.add("1111116");
list.add("1111117");
list.add("1111118");
list.add("1111119");
list.add("11111190");
//每3条一页
Map map=splitList(list,3);
Set keys=map.keySet();
Iterator iterator = keys.iterator();
while(iterator.hasNext()){
Object key=iterator.next();
List pageList=(List)map.get(key);
}
}