Storage Structure

  • Thread starter Spudgun via JavaKB.com
  • Start date
S

Spudgun via JavaKB.com

I am doing a project where I have to set up a client / server system on my
local PC. The client side is a registration and login form. I have the user
able to enter the setails into the registration form and then the client
checks whether the user name has not been taken by passing it to the server
and checking within the records of a hashtable that hold usernames and
passwords. However I also need to store full names, addresses and email
addresss etc preferably in a full name alaphabetical order.

The hashtable won't take all rows so is there some other structure I cna use?
It can't be a databaseon the local machine as I soon as I shut down the
server program it is supposed to lose all data.

Thanks
 
B

Boudewijn Dijkstra

Spudgun via JavaKB.com said:
I am doing a project where I have to set up a client / server system on my
local PC. The client side is a registration and login form. I have the user
able to enter the setails into the registration form and then the client
checks whether the user name has not been taken by passing it to the server
and checking within the records of a hashtable that hold usernames and
passwords. However I also need to store full names, addresses and email
addresss etc preferably in a full name alaphabetical order.

The hashtable won't take all rows so is there some other structure I cna
use?

The hashtable will take all rows if you wrap them in an object. That's what
object-oriented programming is all about. However, if you want to keep
records sorted, you shouldn't use a hashtable.
 
J

Joan

Spudgun via JavaKB.com said:
I am doing a project where I have to set up a client / server
system on my
local PC. The client side is a registration and login form. I
have the user
able to enter the setails into the registration form and then
the client
checks whether the user name has not been taken by passing it
to the server
and checking within the records of a hashtable that hold
usernames and
passwords. However I also need to store full names, addresses
and email
addresss etc preferably in a full name alaphabetical order.

The hashtable won't take all rows so is there some other
structure I cna use?
It can't be a databaseon the local machine as I soon as I shut
down the
server program it is supposed to lose all data.

Thanks

treemap
 
R

Roedy Green

The hashtable won't take all rows so is there some other structure I cna use?
It can't be a databaseon the local machine as I soon as I shut down the
server program it is supposed to lose all data.

You need lookup both by userid and you need sequential access
alphabetically by name?

Sounds like you need to invent a class, lets call it UserDemographics
that encapsulates everything about a user then build an HashMap from
user id to UserDemographics (which includes password), and a TreeMap
from username to UserDemographics. You have two indices on the same
set of objects.

see http://mindprod.com/jgloss/hashmap.html
http://mindprod.com/jgloss/treemap.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top