So I've noticed that doing something like:
LinkedList list = new LinkedList();
Gives you a warning from the compiler, so I was always taught that the correct way was:
LinkedList<Integer> list = new LinkedList<Integer>();
But I've noticed that doing
LinkedList<Integer> list = new LinkedList<>();
Doesn't throw a warning either, although I don't quite understand why. Could someone explain to me the difference between these last two examples, and if one is preferable to another, either style wise or just practically?