This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Representing in a collection

 
Dalia Sultana
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some data in a flat file like the following :

date1 date2 date3

id1 10 12 13
id2 11 12 9
id3 7 9 4

I need to store this in a way so that a value can be easily retrieved by calling something like get(id1,date3), which should return 13.

I am currently thinking off something like this
Hashmap<int, HashMap<Date, value>>

But just wondering if there is an easier/better approach to do this?
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can define your own "data type".
For example:

You can also provide a constructor with parameters to set the fields while instantiating an object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic