Skip to content

Commit

Permalink
Reformat Author and Book classes for online readability
Browse files Browse the repository at this point in the history
Since this code is meant to be embedded in the guide itself, we should
introduce newlines to improve the page layout and avoid scrolls.
  • Loading branch information
bclozel committed Jan 26, 2023
1 parent 802b32b commit 8ed280b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion complete/src/main/java/com/example/graphqlserver/Author.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public record Author (String id, String firstName, String lastName) {
);

public static Author getById(String id) {
return authors.stream().filter(author -> author.id().equals(id)).findFirst().orElse(null);
return authors.stream()
.filter(author -> author.id().equals(id))
.findFirst()
.orElse(null);
}
}
5 changes: 4 additions & 1 deletion complete/src/main/java/com/example/graphqlserver/Book.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public record Book (String id, String name, int pageCount, String authorId) {
);

public static Book getById(String id) {
return books.stream().filter(book -> book.id().equals(id)).findFirst().orElse(null);
return books.stream()
.filter(book -> book.id().equals(id))
.findFirst()
.orElse(null);
}
}

0 comments on commit 8ed280b

Please sign in to comment.