Collections.class methods anachronisms?
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?
.
Relevant Pages
- Re: Collections.class methods anachronisms?
... type safe collections from existing collections with static methods such as .checkedList. ... 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>? ... This passes the compiler, so the code will be compiled to bytecode where it promptly emits a ClassCastException. ... (comp.lang.java) - Re: String and StringBuilder sealed ... another WHY
... But the post was about the String and StringBuilder classes, ... > Sherif ElMetainy wrote: ... >> static methods that manipulates strings. ... >> Best regards, ... (microsoft.public.dotnet.languages.csharp) - Re: Can i pass a SqlConnection object with opened connection to a method/function as a parameter?
... Regards ... those static methods like GetLoginUser, ... GetLoginUser, DataTools.EscapeMask or that the stored procedure doesn't ... possibility of a SQL injection attack by using string concatenation ... (microsoft.public.dotnet.framework) - Re: filenames / extensions with file uploads
... I believe the File and Directory objects have static methods to parse the ... string into its components. ... "Lauchlan M" wrote in message ... > What I want to do is get the filename and the ... (microsoft.public.dotnet.framework.aspnet) - Re: Can i pass a SqlConnection object with opened connection to a method/function as a parameter?
... those static methods like GetLoginUser, ... and do not relate to the sql objects ... possibility of a SQL injection attack by using string concatenation ... >> the existed opened sqlconnection object to do it and pass the object to ... (microsoft.public.dotnet.framework) |
|