• 🎬 Local Record Classes

    (with a “French actors” theme 🇫🇷🎬)

    A local record class is like a local class, except it’s a record declared inside a method body.

    Why it’s useful:
    In stream pipelines you often need a small, temporary “carrier” type for intermediate results (e.g., actor + total earnings). A local record keeps the code readable and strongly typed, without introducing extra top-level classes.

    Example: Top actors by earnings for a given month

    We model:

    • an actor (Actor)
    • a payment for a shooting date (Pay)
    • and inside findTopActors(...) we declare a local record ActorIncome to make stream operations clearer.

    Key point: local records are implicitly static

    Just like nested records, a local record is implicitly static.

    That means:

    • methods inside the local record cannot capture variables from the enclosing method,
    • unlike regular local classes (non-record), which can capture effectively final local variables.

    In short: local records are great for clean, temporary data holders—but they don’t close over method locals.