我有一个可能重复的列表。我通过 ID 识别重复项。这些对象有子对象,现在我想合并重复项,以便子对象仅附加到一个对象。我如何最好地识别重复项,也许是通过流?
public class Foo {
private String id;
private Collection<String> childs;
}
private Collection<Foo> mergeDuplicates(Collection<Foo> fooList) {
/*this method should call the mergeChilds on found Duplicates,
and return the processed Collection of Foos*/
}
private Foo mergeChilds(Foo foo1, Foo foo2) {
...
}
炎炎设计
慕运维8079593
扬帆大鱼
相关分类