Model PageSummary.
public Model(PageSummary ps) {
this.setSopName(ps.getName());
this.setSopContent(getContent(ps.getName(), clientCode, context, httpcliet));
this.setAverageRating(getAverageRating(ps.getName(), clientCode, context, httpclient));
}
:
for (PageSummary ps : pageSummaryList) {
ModelList.add(new Model(ps));
}
Stream API:
// This solution is thread-safe only if ModelList is thread-safe
// Be careful when parallelizing :)
pageSummaryList.stream().map(Model::new).forEach(ModelList::add);
List<Model> models = pageSummaryList.stream()
.parallel()
.map(Model::new)
.collect(Collectors.toList());
ModelList::addAll(models);
Alexis C. , collect concurrency :)