private HashMap<String, List<Tsbdept>> assortListByDeptFy(
List<Tsbdept> deptList) {
HashMap<String, List<Tsbdept>> typeList = null;
if (deptList != null && deptList.size() > 0) {
typeList = new HashMap<String, List<Tsbdept>>();
}
List fyList = null;
for (int i = 0; i < deptList.size(); i++) {
String deptStr = deptList.get(i).getFtypename();
if (GlobalFun.hasValue(deptStr)) {
if (i == 0 || !typeList.containsKey(deptStr)) {
fyList = new ArrayList<Tsbdept>();
typeList.put(deptStr, fyList);
fyList.add(deptList.get(i));
}
else {
List<Tsbdept> tempList = typeList.get(deptStr);
tempList.add(deptList.get(i));
System.out.println(tempList.equals(fyList));
}
}
else {
fyList = new ArrayList<Tsbdept>();
typeList.put(" ", fyList);
fyList.add(deptList.get(i));
}
return typeList;
}
打印结果为什么等于true?数据是当i=0的时候进入if条件句,其余都进入else,为什么fyList和deptList最后的结果是对的,而不是只有i=0时的值。 |
|