• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is there better way to implement?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic