Start New Discussion within our Software Development Community

Hello

I have been trying to code this for the last few days, and i am unable to come
across a solution for this. Would you please mind helping me out on this?

There are some records in a notepad, which are as follows

1
Paul
Mac
3
1
222 222
1
333 334
2
111 234

etc....

2 is number of contacts, paul is the first name, Mac is last name, 3 is the
number of contacts he has, 1 is an indication that the other line contains a
mobile number, 222 222 this is the mobile number (which was indicated above), 1
is an indication for a mobile number (again), 333 334 is the mobile number it
self, 2 is an indication for Office number, and 111 234 is the office number.

What i need to do here is, to have the first name and last name in One List (as
a key/value pair), and to add the phone numbers under
different categories (mobile, office) in to another List (as a key/value pair).

For Example the first name, last name list Should have the following values ::

ContactList
=======

Paul
Mac
there could be other names here, it depends on the number of records in the 
list.

PhoneList
=======

1
222 222
1
333 334
2
111 234
there could be other names here, it depends on the number of records in the 
list.

How could i do this. Code or a Pseudo code please.

Try creating database and use sql to sort these data.
I think this issue related to DBMSs rather than java programing.

This question has already been answered. Start a new discussion instead.