Achieve Syntax Brevity with Anonymous Classes and Instance Initializers
The first listing here, which may look more familiar, is considerably longer than the second listing, even though they’re essentially equivalent. Listing 1.List friends = new ArrayList();friends.add(“Ben”);friends.add(“Kiran”);friends.add(“….”); You can replace