@@ -643,23 +643,24 @@ The following listing shows an example:
643
643
====
644
644
[source,java]
645
645
----
646
- class Product { <1>
646
+ class Product { <1>
647
647
MonetaryAmount getPrice() { … }
648
648
}
649
649
650
650
@RequiredArgConstructor(staticName = "of")
651
- class Products implements Streamable<Product> { <2>
651
+ class Products implements Streamable<Product> { <2>
652
652
653
653
private Streamable<Product> streamable;
654
654
655
- public MonetaryAmount getTotal() { <3>
656
- return streamable.stream() //
655
+ public MonetaryAmount getTotal() { <3>
656
+ return streamable.stream()
657
657
.map(Priced::getPrice)
658
658
.reduce(Money.of(0), MonetaryAmount::add);
659
659
}
660
660
661
661
662
- @Override public Iterator<Product> iterator() { // <4>
662
+ @Override
663
+ public Iterator<Product> iterator() { <4>
663
664
return streamable.iterator();
664
665
}
665
666
}
@@ -673,8 +674,8 @@ interface ProductRepository implements Repository<Product, Long> {
673
674
A standard constructor taking the `Streamable<Product>` will do as well.
674
675
<3> The wrapper type exposes an additional API, calculating new values on the `Streamable<Product>`.
675
676
<4> Implement the `Streamable` interface and delegate to the actual result.
676
- <5> That wrapper type can be used as a query method return type directly .
677
- You need not return `Streamable<Product>` and manually wrap it in the repository client.
677
+ <5> That wrapper type `Products` can be used directly as a query method return type.
678
+ You do not need to return `Streamable<Product>` and manually wrap it after the query in the repository client.
678
679
====
679
680
680
681
[[repositories.collections-and-iterables.vavr]]
0 commit comments