This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

raw or classic ?

 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I decide to use the java 1.5.0 for my assignment - even if I not the ultimate expert on this theme - and one of my favorite feature are the generics.
I try to use them everywhere, or better nearly everywhere but I still have places where I find the raw usage better.
By example : I have a (java.util)Map with some properties and in the actual stage all the keys and values are String(s) , but the situation can change in the future(lets say that a typesafe enum will be used) so I find unproper the generics usage - they constraints the flexibility.

With other words the genrics are ok but a overdose can transform from a bless in to course.

What are you thinking guys ?


Regards,
Mihai
[ February 27, 2006: Message edited by: Mihai Radulescu ]
 
Kevin Conaway
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mihai,

The whole point of using generics is a situation when you know, at compile time, what your types will be.

If the types in your collection can change, you should definitely not use generics.

They're not to be used everytime you use a collection.

Kevin
[ February 27, 2006: Message edited by: Kevin Conaway ]
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kevin,


I thought about this, I come on thisd idea using the new Eclipse 3.2, here i found this "warning" (Java Compiler->Generic Types->Usage of raw type).


Regards,
Mihai.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic