coffee_fan (27) [Avatar] Offline
It is not hard to create it, but for folks that are following along it is one annoyance.
v8 (6) [Avatar] Offline
filterByType method is included in the DesignTacoController source code.
I assume the author didn't include it in the listing as it brings no value for the understanding of the concepts.

	private List<Ingredient> filterByType(List<Ingredient> ingredients, Type type) {
				.filter(x -> x.getType().equals(type))
habuma (279) [Avatar] Offline
That's right...I left it out of the manuscript because it didn't pertain directly to the subject. It's fairly brief, so I guess I could consider working it in. But for space reasons and subject-focus reasons, I can't practically include *ALL* of the code in the book.
190896 (14) [Avatar] Offline
Agree, I would put it in the book. There's nothing worse than following along and then finding it doesn't compile.
johannkokos (4) [Avatar] Offline
I hope the author mentioned the the function could be found in the source code. A simple note is enough.
409563 (4) [Avatar] Offline
Also these in the same listing:

- `package tacos.web;` should be `package tacos;`
- `import tacos.Taco;` this import cannot be resolved.
CounterClockWise (2) [Avatar] Offline
Listing 2.2 refers to the class Taco; I have not found in the pdf, the web site, or the downloaded source code. I created a dummy Taco class (and the filterByType method) to get listing 2.2 to compile.

But then I had trouble running the code; I kept getting obscure Thymeleaf errors when trying to access http://localhost:8080/design. I ended up commenting out these two blocks from Listing 2.3/design.html:

<span class="validationError"
th:errors="*{ingredients}">Ingredient Error</span>
<input type="text" th:field="*{name}"/>
<!--end::all[] -->
<span class="validationError"
th:errors="*{name}">Name Error</span>

I don't know enough about Spring 5 and Thymeleaf to know whether these go away when has the right contents. It is slowing down my learning journey.