Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

258
Views
¿Cómo eliminar un elemento de lista de matriz usando un temporizador?

Entiendo que para eliminar una lista de arreglos de un arreglo, debe usar list.remove();

Sin embargo, cuando hago eso, todo mi programa se detiene. He declarado un método para realizar una cuenta regresiva cuando se supone que se debe eliminar el elemento y no funciona. Aquí está la declaración:

 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); }

Lo llamé a mi programa y ahora no quiere funcionar.

 if(value==0){ type = "Slow Customer"; if(customers.contains(type)){ longWait(15); } }

El programa genera clientes aleatoriamente cada cantidad de segundos utilizando el servicio ScheduledExecutor. Lo que realmente estoy tratando de hacer es eliminar un elemento de la lista de arreglos después de x cantidad de segundos. Cualquier ayuda sería apreciada.

 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 }
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!