• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there better way to implement?  RSS feed

 
krishnapriya varma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!