The Collections class is supposed to, among other things, return
type safe collections from existing collections with static methods
such as .checkedList().
My question is: What is so special about these static methods since
we can do the same thing by declaring the original list generically
with a type like <String>? I mean, once you create the list with
<String the compiler will no longer allow you to add, say,
Integer to the list. So what purpose does .checkedList() provide
in that context?
Maybe it's all about backward compatibility?
type safe collections from existing collections with static methods
such as .checkedList().
My question is: What is so special about these static methods since
we can do the same thing by declaring the original list generically
with a type like <String>? I mean, once you create the list with
<String the compiler will no longer allow you to add, say,
Integer to the list. So what purpose does .checkedList() provide
in that context?
Maybe it's all about backward compatibility?
Comment