File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Representing in a collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Representing in a collection" Watch "Representing in a collection" New topic
Author

Representing in a collection

Dalia Sultana
Ranch Hand

Joined: Jul 16, 2006
Posts: 42
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

Joined: Aug 02, 2005
Posts: 167

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Representing in a collection