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, ...

Get Functional Programming in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.