【发布时间】:2011-04-21 15:43:45
【问题描述】:
我有课 -
public class Data implements Identifiable{
private Integer id;
public Integer getId(){
return id;
}
}
现在我有两个系列-
List<Data> data1 = // few hundred Objects
Set<Integer> dataIds = // few object ids
我想从data1 中提取List<Data>,它的ID 在dataIds 中
我的方法应该如何?我的类路径中有番石榴,因此如果在性能/效率方面具有可比性,可以使用番石榴的功能方法。
【问题讨论】:
-
如果 dataId 对应于 List 对象的 ID,那么为什么一个是 Integer 而另一个是 Long ?另外,使用什么集合类型?例如: data1 是 ArrayList 还是 LinkedList ?
标签: java collections guava