Refactoring to Functional Style

preview_player
Показать описание
Venkat Subramaniam, President, Agile Developer, Inc.

In Java we've programmed with the imperative style for a few decades now. With Java 8, we can also code in functional style, which has several benefits: concise code that’s more expressive, easier to understand, and easier to change. But the transition from imperative to functional style is a hard journey. It’s not as much an issue of getting comfortable with the syntax—it’s the challenge of thinking functionally. What better way to learn that transition than taking imperative code and refactoring it to a more functional style. This presentation starts with multiple code examples written in imperative style and shows how to approach refactoring them to functional style.
Рекомендации по теме
Комментарии
Автор

Your grouping example kills me. I absolutely love collectors. My instinct would have been to stream the entryset, since looping over the keyset and doing a get() per key is an anti-pattern no matter how you do the iteration. You can still use Collectors to avoid that anti-pattern but it gets ugly so fast compared to your example.

Jebusankel