This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to store details from file in an object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to store details from file in an object" Watch "how to store details from file in an object" New topic
Author

how to store details from file in an object

Adrian Ronayne
Greenhorn

Joined: Sep 13, 2006
Posts: 8
Hi all,

I have data in a file that I want to store in some kind of object. This file contains lines of data (name, age, gender) like so:

angela 30 female
mike 45 male
danny 20 male
sharon 27 female

What is the best way to store this data, in my view there are two possible options:

1. A list of objects where one line corresponds to one object.

2. One object where which keeps seperate Lists for each field in the file.

What are your thoughts?

Thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

The Java way is the first one.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to store details from file in an object