地产项目我有一个JList peopleList填充Person类查找的jList
class Person
{
private String name;
private String age;
private void setName(String value)
{
name = value;
}
private String getName()
{
return name;
}
}
当前的对象找到名字是我一个人在做
public boolean personByNameExists(String name)
{
for(int index = 0 ; index < peopleList .getModel().getSize() ; index ++)
{
Person pl = (Person) peopleList .getModel().getElementAt(index);
if(p1.getName().equals(name))
{
return true;
}
}
}
我想知道是否有通过整个列表进行相同操作的方式。我来自.Net背景和C#我会使用LINQ在Java中有类似的东西吗?
可能的重复[过滤和排序列表使用谷歌收藏](http://stackoverflow.com/questions/2312849/filter-and-sort-list-using-google-collections) – haylem 2012-03-02 15:41:15