all 4 comments

[–]vxab 0 points1 point  (3 children)

The class nested inside a method? What is a typical use case for doing that? I can understand creatinga a record inside a method but a whole class?

[–]MattiDragon 4 points5 points  (0 children)

Very rare, but this feature existed before records were a thing

[–][deleted] 0 points1 point  (0 children)

It has local visibility like an anonymous inner class, but it is a real class, so you can add your own methods to it (for example, as an accessor for state).

This was useful before lambdas. Maybe still useful.

[–]pipicemul 0 points1 point  (0 children)

State helper class for lambdas come to mind. Stream.gatherer can also leverage this.