/***************************************************************************
* 把传入的list按照receiveBranchId分组 分好的组再存入 另一个List[],list[]每个元素就是一个包的所有票据
*
* @param list 要分组的List
*/
public static List[] MakeBagDaobyHand(List list) {
Set set = new HashSet();
for (int i = 0; i < list.size(); i++) {
//TBill tb = (TBill) list.get(i);
/// int receiveBranchId = tb.getReceivebranchId().intValue();
// set.add(receiveBranchId);
int a = (Integer)list.get(i);
set.add(a);
}
List[] arr = new ArrayList[set.size()];// 每个元素是相同receiveBranchId的TBill
Iterator it = set.iterator(); // Set里保存相同的receiveBranchId
int count = 0;// 计算Set遍历set的ID
while (it.hasNext()) { // 遍历
int rid = (Integer) it.next();
arr[count] = new ArrayList();
for (int i = 0; i < list.size(); i++) {
int listId = (Integer) list.get(i);
if (rid == listId) {
arr[count].add(rid);
}
}
count++;
}
return arr;
}