Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linked list multiple input

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
how can i store multiple forms of data in a linked list list and access each node by its description.
For example:

if my categories are:
employee id
employee name
employee position
employee salary

how do i store these into a linked list in ascending order by employee number and make each category searchable through a main switch-statement-type menu?

confusedKid
 
You are no longer looking for a LinkedList or any other Collection, you are looking for a Database. No reason to go about reinventing the wheel either, there are quite a number of databases (free and otherwise) on the market.

BTW, a LinkedList is just a way to get Objects from one place to another.
 
Should in fact be a database for permanent storage.
Inside your java app it should be an object

public class Employee
{
private String name, id, position;
private double salary;

public Employee(String name, String id, String position, double salary)
{
this.name=name;
this.id=id;
this.position=position;
this.salary=salary;
}
public String getName()
{
return name;
}
//do get and set methods for all fields
}

Now you just check each object's name or id value
and you know the rest are correct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top