What is Double Brace initialization syntax ({{ ... }}
) in Java?
The first brace creates a new Anonymous Class and the second set of brace creates an instance initializers like the static block.
Like others have pointed, it's not safe to use.
However, you can always use this alternative for initializing collections.
List list = new ArrayList<>(Arrays.asList("A", "B", "C"));
List list = List.of("A", "B", "C");