【发布时间】:2012-08-30 13:23:24
【问题描述】:
我有一个人对象的集合 A,并且这个人有一个名为“ID”的属性。 我还有一个由 personcountry 对象组成的集合 B,并且 personcountry 对象有一个属性 personId。
现在我想选择集合 A 中的所有人员,集合 B 中有一个对象及其 personId。
所以有了这些数据
person (collection A List[Person])
person id name
1 John
2 John
3 John2
4 Pete
5 Bill
6 Samantha
还有这个集合 B (List[Country])
country id personid
1 1
1 3
2 5
我想要集合 A 中 id 为 1,3 和 5 的人员记录。
我确实设法使用 intersect 方法使用 2 个整数集合来做到这一点,但是在使用这两个对象集合时我被卡住了。
【问题讨论】: