O'Reilly logo

Functional Programming in Java: How functional techniques improve your Java programs by Pierre-Yves Saumont

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Handling state mutation in a functional way

This chapter covers

  • Creating a functional random number generator
  • Designing a generic API for handling state mutation
  • Handling and composing state operations
  • Using recursive state operations
  • Generic state handling
  • Building a state machine

In this chapter, you’ll learn how to handle state in a purely functional way. In the previous chapters, state mutation was avoided as much as possible, and you might have come to believe that state mutation is incompatible with functional programming. This isn’t true. In functional programming, it’s perfectly possible to handle state mutation. The only difference from what you may be used to is that you have to handle state mutation functionally, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required