两个带有相同对象的列表根据“计数”排除对象。
我有一些问题找到解决问题的解决方案。
我有2个列表,它们具有相同的对象,但没有相同数量的对象。因此,举一个快速示例:
List1: Object1(ID (1), Name (James)); Object2(ID(1), Name(John)); Object3(ID (1); Name(Jane)); Object4(ID (2), Name(Carl))
List2: Object1(ID(1), Name (James)), Object2(ID(1), Name(John)), Object3(ID (2), Name(Carl))
因此,在上面的示例中,我们需要删除任何具有ID(1)的对象,而我们的列表仅包含对象(4),因为我们没有相同数量的对象ID编号,如果不清楚,它并不总是我ID(1),它可以包含ID(7),ID(15),ID(123)同样。 这是一个非常简单的示例,实际上,列表将包含数百个对象,但前提是相同的。
(我们必须从列表1中删除比列表2中的任何对象1的任何对象1)
道歉,如果这令人困惑或解释不当,我会很乐意在需要时尝试详细说明。
谢谢
I have a bit of an issue finding a solution for a problem.
I have 2 lists, they have identical objects, but not the same amount of objects. So to give a quick example:
List1: Object1(ID (1), Name (James)); Object2(ID(1), Name(John)); Object3(ID (1); Name(Jane)); Object4(ID (2), Name(Carl))
List2: Object1(ID(1), Name (James)), Object2(ID(1), Name(John)), Object3(ID (2), Name(Carl))
So in above example we need to remove any object that has ID(1), leaving us with a list that only contains object(4), because we do not have the same amount of objects with the same ID number, and if this is not clear, it will not always me ID(1), it could contain ID(7), ID(15), ID(123) aswell.
This is a very simplified example, in reality the lists will contain several hundred objects, but the premise is the same.
(We have to remove any object from List 1 that counts more objects with an ID number than what exists in List 2)
Apologies if this is confusing or poorly explained, I will happily try to elaborate if needed.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它可能不是最佳的,但
It might be not optimal but,