Filtering on List based on one property with guava

前端 未结 2 1687
陌清茗
陌清茗 2021-01-04 07:58

I have a class called Person -

public class Person implements Nameable {
    private String name;

    public String getName(){
        return name;
    }
}         


        
2条回答
  •  日久生厌
    2021-01-04 08:18

    Seems like you will have to manually iterate over both Lists (sounds lame, but that's the only thing I could think).

    outer loop: persons
       inner loop: subsetOfPersons
           compare person and sub person names and create another list with intersection of the      two
    

提交回复
热议问题