What is the difference between List <String> list = new ArrayList<>();
vs List <String> list = new ArrayList<String>();
static void first(){
List <String> list = new ArrayList<>();
list.add("hello world");
String s = list.get(0);
static void second(){
List <String> list = new ArrayList<String>();
list.add("hello world");
String s = list.get(0);
Edit 1: This question intends the need to clarify the difference of using String in diamond operator in the "second" method and how it is different from "first" method where String is absent from the diamond operator. Why explicitly mention String in the diamond operator if the method works without stating it? My question has nothing to do with diamond operator, it's about what's inside those operators.
Edit 2: This question is not about diamond operators.