KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The diamond operator in java 7 allows code like the following: List<String> list = new LinkedList<>(); However in Java 5/6, I can simply write: List<String> list = new LinkedList(); My understanding of type erasure is that these are exactly the same. (The generic gets removed at runtime anyway). Why bother with the diamond at all? What new functionality / type safety does it allow? If it doesn't yield any new functionality why do they mention it as a feature? Is my understanding of this concept flawed?
Tags (comma-separated)
Save Edits
Cancel