两个List列表(非基本类型),找出其中存在差异的条目

有两个List 内存储item {id,count};

List1 [{1,2},{2,3},{3,4},{4,5}];

List2 [{2,2},{3,5},{4,5},{5,8}];

找出List2中比List1中多出来的项,减少的项,和改变并变多的项,改变并减少的项;后两种的item.count为变化值

如 多:List[{5,8}]; 少:List[{1,2}],改变少:List[{2,1}],改变多:List[{3,1}]

 class A
{
public int id;
public int count;
}

for (A item : list1)
{
    A item2 = null;
    for (A i : list2)
        { if (i.id == item.id) { item2 = i; break; }}
        if (item2 == null) 少了这个条目
        if (item2.count > item.count) 改变多
        if (item2.count < item.count) 改变少
}
多了条目,你就交换list1 list2循环,list2少了就是list1多了。