diff --git a/src/main/asciidoc/repositories.adoc b/src/main/asciidoc/repositories.adoc index a55683a5a..2e0b978b7 100644 --- a/src/main/asciidoc/repositories.adoc +++ b/src/main/asciidoc/repositories.adoc @@ -643,23 +643,24 @@ The following listing shows an example: ==== [source,java] ---- -class Product { <1> +class Product { <1> MonetaryAmount getPrice() { … } } @RequiredArgConstructor(staticName = "of") -class Products implements Streamable { <2> +class Products implements Streamable { <2> private Streamable streamable; - public MonetaryAmount getTotal() { <3> - return streamable.stream() // + public MonetaryAmount getTotal() { <3> + return streamable.stream() .map(Priced::getPrice) .reduce(Money.of(0), MonetaryAmount::add); } - @Override public Iterator iterator() { // <4> + @Override + public Iterator iterator() { <4> return streamable.iterator(); } } @@ -673,8 +674,8 @@ interface ProductRepository implements Repository { A standard constructor taking the `Streamable` will do as well. <3> The wrapper type exposes an additional API, calculating new values on the `Streamable`. <4> Implement the `Streamable` interface and delegate to the actual result. -<5> That wrapper type can be used as a query method return type directly. -You need not return `Streamable` and manually wrap it in the repository client. +<5> That wrapper type `Products` can be used directly as a query method return type. +You do not need to return `Streamable` and manually wrap it after the query in the repository client. ==== [[repositories.collections-and-iterables.vavr]]