com.github.saphyra.randwo.common.CollectionAggregator Maven / Gradle / Ivy
package com.github.saphyra.randwo.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Component;
@Component
public class CollectionAggregator {
public List aggregate(List... lists) {
List result = new ArrayList<>();
for (List list : lists) {
result.addAll(list);
}
return result;
}
public Map aggregate(Map... maps) {
Map result = new HashMap<>();
for (Map map : maps) {
result.putAll(map);
}
return result;
}
}