This is the instance block that is executed when constructing the anonymous subclass.
If there is no good reason, do not do this. Prefer:
List<String> nodes = Arrays.asList("n1", "n2");
Or if you need volatility:
List<String> nodes = new ArrayList(Arrays.asList("n1", "n2"));
Because the anonymous class maintains a reference to the containing instance of the class that it declared, which could lead to memory leaks.
source share