Meaning of new Class(…){{…}} initialization idiom [duplicate]
It’s called double curly brace initialization. (EDIT: Link removed, archived here) It means you’re creating an anonymous subclass and the code within the double braces is basically a constructor. It’s often used to add contents to collections because Java’s syntax for creating what are essentially collection constants is somewhat awkward. So you might do: List<String> … Read more