Multidimensional ArrayList in Java -


i'm simulating supermarket, various checkout lines, , each of them has own queue, customers added when finish shopping. both customers , checkouts clases, instantiated in main class using arraylists.

arraylist<customer> customerlist=new arraylist<customer>(maxcustomers); (i=0;i<maxcustomers;i++){     customerlist.add(new customer(randomitems, randomarrival); } 

i create checkouts in simmilar way.

arraylist<checkout>checkoutlist=new arraylist<checkout>(maxcheckoutlines); (i=0;i<maxcheckoutlines;i++){     checkoutlist.add(new checkout()); } 

the problem here want create arraylist simulate 1 queue in each checkout, add customers when finish shopping. don't know if should use multidimensional arraylist when creating checkouts, , know how operate when adding customers. regards

the class checkout can contain field of arraylist<customer> should add customers to.

public class checkout {     public arraylist<customers> custlist = new arraylist<>();     ....  public static void main(string[] args){     arraylist<checkout> chkouts = new arraylist<>();      chkouts.add(new checkout());     chkouts.get(0).custlist.add(new customer()); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -