Refactoring to Functional Style
summary
Starts from noisy imperative examples and shows concrete refactorings in Java using the Java Stream API: replace mutable loops with filter map noneMatch to find an uppercase name older than 30 and prove laziness by instrumenting getAge so the stream stops at "Paulo". Uses IntStream noneMatch for primes, Files.lines().filter().count for host search, Collectors.groupingBy to invert scores, and a Stream.iterate plus flatMap for one-to-many to generate ten Pythagorean triples and sum square roots of primes with lazy, limited evaluation.
AI-written summary · about
chapters (7)
- 0:00Start
- 4:08Higher-Order Functions
- 5:08Declaration Style
- 6:07Functional Composition
- 13:56What Does a Benefit this Code Really Offers
- 43:06Map Operation
- 46:05Example of Accidental Complexity
related talks
40mDesigning Function Families and Bundles with Java's Behaviours Parameterization and Lambdas
27mWhy functional is the new black
50mFrom Javascript to Haskell : Functional Programming made simple
27mPractical functional programming: pick two
30mLearning Functional Programming with JavaScript
53mMaintainable JavaScript with Functional Patterns
11mIntroduction to functional programming
40mSimplicity through Functions
