Does apex have anything like anonymous inner classes?
Afraid it's not supported. Apex does have inner classes, up to one level deep, but there is no support for anonymous inner classes.
The closest you're going to be able to do is make private inner classes and use those in methods, which half defeats the point.
Good thing @ca_peterson is pushing this as he joint forces with Salesforce. Have a look a this Dreamforce '19 Talk at around 15:45 and also mentioned in the Q&A part. I guess this feature will be announced soon.