Skip to content

Commit

Permalink
Refactor formatting and simplify forEach method
Browse files Browse the repository at this point in the history
Updated the formatting and simplified the forEach method in ProcessDictionary. Removed the formatted() method in favor of the simpler printf() syntax, and formatted the record declaration in AstroResponse.
  • Loading branch information
kousen committed Aug 5, 2024
1 parent adfa6c9 commit 13505ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/kousenit/fileio/ProcessDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void printTenLongestWords() {
)
.limit(10)
//.forEach(w -> System.out.printf("%s (%d)%n", w, w.length()));
.forEach(w -> System.out.printf("%s (%d)%n".formatted(w, w.length())));
.forEach(w -> System.out.printf("%s (%d)%n", w, w.length()));
// .forEach(w -> logger.info(() -> "the word is " + w + " and its length is " + w.length()));
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/kousenit/http/AstroResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
// ...
// ]
// }
public record AstroResponse(
String message,
int number,
List<Assignment> people) {
public record AstroResponse(String message, int number, List<Assignment> people) {
public record Assignment(String name, String craft) { }

// compact constructor
Expand Down

0 comments on commit 13505ea

Please sign in to comment.