The diamond operator in java 7 allows code like the following:
List list = new LinkedList<>();
However in Java 5/6, I c
When you write List
, compiler produces an "unchecked" warning. You may ignore it, but if you used to ignore these warnings you may also miss a warning that notifies you about a real type safety problem.
So, it's better to write a code that doesn't generate extra warnings, and diamond operator allows you to do it in convenient way without unnecessary repetition.