I understand that in order to remove an array list from an array, you must use list.remove();
Yet, when I do that, my entire program stops. I've declared a method to count down when the element is supposed to be removed and it's not working. Here's the declaration:
public static void longWait(int time) {
scheduler.schedule(new Runnable() { public void run() {
//customers.remove(customerIterator.nextIndex());
customers.remove(customers.indexOf(type));
System.out.println(type + " has left.");
}}, time, TimeUnit.SECONDS);
}
I called it into my program, and now it doesn't want to work
if(value==0){
type = "Slow Customer";
if(customers.contains(type)){
longWait(15);
}
}
The program randomly generates customers every amount of seconds using scheduledExecutorService. What I'm really trying to do is remove an array list element after x amount of seconds. Any help would be appreciated.
Customers customer = new Customer(type);
List<Customer> newCustomers = new ArrayList<Customer>
if(newCustomers.contains(type)){
longWait(15). //Supposed to wait 15 second then remove the customer but nothing is happening
}