SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private ArrayList<Articulo> coleccion = new ArrayList();
  2.  Iterator<Articulo> iter = coleccion.iterator();
  3.      
  4. public String borrarArticulo() {
  5.         String codigo = null;
  6.  
  7.  
  8.         try {
  9.  
  10.                 System.out.println("Por favor introduzca el codigo del articulo");
  11.                 codigo = teclado.nextLine();
  12.                 ValidarCodigo(codigo);
  13.  
  14.             while (iter.hasNext()) {
  15.                 if (iter.next().getCodigo().equals(codigo)) {
  16.                     iter.remove();
  17.                     System.out.println("Producto eliminado");
  18.                 }
  19.             }
  20.         } catch (Exception e) {
  21.             System.err.println("Error");
  22.         }
  23.         return codigo;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top