November 2024
Intermediate to advanced
300 pages
7h 12m
English
One concept might be the basis for another. If you’ve provided an implementation of “capitalize a word” as a standalone method, you can incorporate it into the slightly larger concept of capitalizing all words within a sentence:
| | public String capitalizeAllWords(String sentence) { |
| | return Arrays.stream(sentence.split(" ")) |
| | .map(this::capitalize) |
| | .collect(joining(" ")); |
| | } |
Implementing smaller concepts as methods provides numerous benefits:
Read now
Unlock full access