File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/main/java/org/spacious_team/broker/report_parser/api Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2727import java .util .Collection ;
2828import java .util .Collections ;
2929import java .util .List ;
30+ import java .util .stream .Collectors ;
3031
3132@ RequiredArgsConstructor (access = AccessLevel .PRIVATE )
3233public class WrappingReportTable <RowType > implements ReportTable <RowType > {
@@ -85,14 +86,17 @@ private static class LazyWrappingReportTable<RowType> implements ReportTable<Row
8586 @ Getter
8687 private final BrokerReport report ;
8788 private final ReportTable <RowType >[] tables ;
89+ private volatile List <RowType > data ;
8890
8991 @ Override
9092 public List <RowType > getData () {
91- List <RowType > data = new ArrayList <>();
92- for (ReportTable <RowType > table : tables ) {
93- data .addAll (table .getData ());
93+ if (data == null ) {
94+ data = Arrays .stream (tables )
95+ .map (ReportTable ::getData )
96+ .flatMap (Collection ::stream )
97+ .collect (Collectors .toUnmodifiableList ());
9498 }
95- return Collections . unmodifiableList ( data ) ;
99+ return data ;
96100 }
97101 }
98102}
You can’t perform that action at this time.
0 commit comments