aspose file tools
The moose likes Java in General and the fly likes need help to read the contents from a text file and store in a list Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "need help to read the contents from a text file and store in a list" Watch "need help to read the contents from a text file and store in a list" New topic
Author

need help to read the contents from a text file and store in a list

Shree Chinnu
Greenhorn

Joined: Jan 16, 2010
Posts: 7
Hi I have a problem in my code

I have to read a text file of this format

int num_thread => Total number of threads in the file

for (i = 0; i < num_thread; i++)
{
int num_message_i => Total number of messages of the next thread i
int => Total number of reference to the next thread i
for (j = 0; j < num_message_i; j++)
{
String => Author of the message
Double => Age (Posting Time) of the message
String => Title of the message
String => Contents of the message
}
}


The code I have written is as follows


But when I am trying to retrieve the data from the threadList


Only the Last message data is printed threadList.size() times.

Kindly let me know what might be the reason for this
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

edit your post to use code tag . use *code tag* while you are posting code
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: need help to read the contents from a text file and store in a list
 
Similar Threads
Problem with Treemaps
I implemented runnable.... I think...
How to initialize an Array in this occasion?
Doubt about StringTokenizer !!
ArrayIndex OutOfBoundsException?