What is the difference between the following two statements, in initializing an ArrayList
?
ArrayList<String> a = new ArrayList<String>();
ArrayList<String> a = new ArrayList<>();
Before Java 1.7, only this one is permitted:
ArrayList<String> a = new ArrayList<String>();
And in 1.7, this is added, which is the same but shorter: (all programmers are lazy)
ArrayList<String> a = new ArrayList<>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With