Hi all,
This along with many of the other questions on this forum is from a noob at both the forum and java and was hoping someone could please help me.

What im trying to do is read some info from a file and then store it in a linked list, which i then can recall the information for each section when tested.
Its kinda hard describing the situation but what i have is a file

-from file that i read from
Telephone Book
-----
1 Mick <- Ref and Name (int, string)
0444767521 mobile number <- Info (int, string)
123 helshow road <- Info (int, string)
-----
2 Angela
0426566654 mobile number
555-8977 house number
45 newmart road
-----
etc...

So what i have to do is have a linked list that stores the Name eg.Mick and his ref number eg.1 and then store all his info. Then point to next person who is 2 Angela and then store all her info.
Now what i have done so far is seperated everything up and can store all the names and refs in a linked list and then was going to store all the info in a seperate linked list for each (Name and refs) that is in the list.

I hope this doesnt sound to confusing but im completely stuck on what to do or how to be able to implement anything to achieve the desired result.

Any help or guideance would be greatly appreciated.

Thanks in advance,
Phillip

So do you want to store all information for one person in one LinkedList, or are you wanting to parse through it and store the Name, Address, and Phone number all in seperate LinkedLists?

Hi,

I think you have already done the hard part of parsing. Now u can simpy use one of the many list implmentation classes of Java to organise your info. First of all make a class with objects as e.g.

class Node
{
int referenceId;
String name ;
LinkedList additionalInfo ;
}

Now as u parse in your main list (again an object of Linked list) add members of class Node. For additional info , since you dont have a rigid format simply add each element as a line of String or if you have any format make a suitable class.

So do you want to store all information for one person in one LinkedList, or are you wanting to parse through it and store the Name, Address, and Phone number all in seperate LinkedLists?

No i dont want to store them all in seperate list for each other but put persons name and data together, but be bale to search and view each persons data.

I think you have already done the hard part of parsing. Now u can simpy use one of the many list implmentation classes of Java to organise your info. First of all make a class with objects as e.g.

class Node
{
int referenceId;
String name ;
LinkedList additionalInfo ;
}

Now as u parse in your main list (again an object of Linked list) add members of class Node. For additional info , since you dont have a rigid format simply add each element as a line of String or if you have any format make a suitable class.

I sort of underdstand what u mean but cant seem to implement it to do that. One of main things i cant do, considering that part of problem description is use and of linked list classes of java and that i have to create my own linked list class. But can only use one linked list class too.

YAY!!!

Thank you all very much for trying to help me with my problem but i think like aj.wh.ca said, "I had already done the hard part". Worked out the problem that i was having and fixed it all up so everything is now working fine.
:D:D:D
(it feels the best when u finally solve the problem yourself, after hours of thought)

Thanks once again for all your help and suggestions.

This article has been dead for over six months. Start a new discussion instead.