What’s new in J2SE5.0? Part One – Generics
J2SE 5.0 is unlike earlier Java releases where the creators added new functionality without touching the core language. With J2SE 5.0 a lot of things have changed even with the basic Java language.
In this article, Chinmay Ogale looks at what is perhaps the most talked about change in J2SE 5.0, Generics.
—————————————————————————
What’s new in J2SE 5.0?
Part One – Generics
J2SE 5.0
Release Date: 30th September, 2004
Code name : Tiger
J2SE5.0 is one of the major Java releases since Java came into existence almost a decade ago. Most java enthusiasts have been waiting for this release as it featuresÂ
Actually collection allows us to store different objects.
List mylist = new ArrayList();
will allow us to store only String objects.I think it will be a great disadvantage
[I]Till today, our clients have not been aware what version of JDK we have been using.[/I]
What does that matter? Besides, you don’t *have* to upgrade. The new features are a part of the language and promote type-safety.
[I] it will force us to redefine our public interfaces (besides implementation) to our external clients/partners.[/I]
Like any new language feature, you are not forced to do anything. However, depending on who your ‘clients’ are (eg. programmers or just end-users), they may demand the ability to use new features. However, old code will still work just as well as before without any changes at all.
Generics offer conveniance and properly typed containers. They don’t take away anything and certainly don’t force you into anything (unless you want to use them).
We have worked so hard to make our applications stable on J2SE1.4.x. If I understand ‘Generics’ correctly, it will force us to redefine our public interfaces (besides implementation) to our external clients/partners. Isn’t that bad? Till today, our clients have not been aware what version of JDK we have been using. But after J2SE5, they will know… :sigh
I think this is just ti avoid something like class cast exception Only AT COMPILE TIME. and if i’m placing values or manuplating values at run time i’ll face same problem or class cast exception 😕
if i am missing something then let me know.. but what’s Generics’s advantage if we consider problems of run time?
Generics is nice. But not sure if changing the core Java language will lead to more confusion or benefits.