In Java 7, the Java compiler can use type inference to allow you to change the verbose:
List<String> list = new ArrayList<String>(); into the less verbose: List<String> list = new ArrayList<>(); Since you are assigning to a List<String>, the only type you can possibly use in an ArrayList<> is a String, so you can omit it. Gary On Mon, Jul 24, 2017 at 5:20 PM, kenneth mcfarland < [email protected]> wrote: > I have a simple question as why there is generic arrays like new > ArrayList<>(); in classes like: > > log4j-core/src.../core/builder/impl/DefaultComponentBuilder(); > > Note, this is not a "why didn't you do it differently" question, I am > asking so I can learn from you. Thx. > > Kenneth >
