wood burning stoves*
The moose likes Beginning Java and the fly likes Is there better way to implement? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there better way to implement?" Watch "Is there better way to implement?" New topic
Author

Is there better way to implement?

krishnapriya varma
Greenhorn

Joined: Nov 07, 2007
Posts: 2
Hello.....

I would like to know whether what i have done is the best way to implement:
I have a method that takes a Date value and a String value as parameters. I have a set of dates and the string value pairs. I have stored it in a multidimentional array, and while passing to method, i have converted the String to Date. Here is my code:




Can you please tell me if there is a better way to implement this? Is there any other Collection that i can use?


Thanks a lot in advance!!!
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I would change from using a multi-dimensional array to using an array of Parameter objects, which have a date and String property (though it might be a Date andInteger, since the String value looks like its going to be a number)). This saves you the headache of managing a multi-dimensional array, means you don't have to worry about the date format and stops someone changing string values in your array causing the application to crash.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
jQuery in Action, 2nd edition
 
subject: Is there better way to implement?
 
Similar Threads
Convert to timestamp yyyy-MM-dd hh:mm:ss a
String GMT Date conversion to EST/EDT
cewolf in struts
JSP attendance management project error
try/catch vs null check