starting out with Java and have run into some issues. I have created a class called: Admin, which a user will give attributes to such as a name and other pedigree info...but the main function of the Admin class is to create arrays that will be used as a queue system.
I am trying to allow the Admin to create as many arrays as they desire. However I am having trouble figuring out a way to differentiate between each of the arrays when it comes to reiterating them back to the user. For instance, lets say an "Admin" was a Bank and wanted to create an array that a "User"(i.e. customer, which has it's own class) could join to get in line to see a teller. The Bank may also want to create a line for a "User" to see a Loan Officer, etc.
I am not able to allow the Admin to give each array a specific reference variable that would differentiate it from others by doing this:
System.out.println("Enter the name of the line you wish to create: ");
String lineName=keyboard.nextLine();
ArrayList<User>lineName=new ArraryList();`
The program gives an error saying that the variable has already been initialized in the method when I do so, which I kind of understand. However having the functionality of knowing what line I am looking at within the code is invaluable to me. Another reason I wish to do this is because I want to create an Array of Arrays that would show a customer all of the "lines" they could potentially join. So I would like the output to look something like this:
John Hancock Bank lines:
Teller Window
Loan Officer
Mortgage Specialist
etc.
From there I would allow the user to access the element of the array they wish to join.
What would be the best way to "identify" each specific array that is created by an Admin?
Map<String, List<User>. However, are you certain the aListis appropriate? I might think a queue or stack structure would better model a line of people.