Ver Mensaje Individual
  #6 (permalink)  
Antiguo 05/06/2009, 09:10
javix3
 
Fecha de Ingreso: junio-2009
Mensajes: 1
Antigüedad: 14 años, 11 meses
Puntos: 0
Respuesta: Problema eliminando elemento de un ArrayList

Proba esto y contame =)

Código:
 public void sacaCoche(String matricula)
	{
		Coche cocheABorrar = null;
                Iterator itera = this.listadoCoches.iterator();

		while(itera.hasNext())
		{
			Coche coche = itera.next();
			if(coche.getMatricula().equalsIgnoreCase(matricula))
			{
				cocheABorrar = coche;
				break;
			}
		}
		if( cocheABorrar == null )
			System.out.println("Coche no encontrado");
		else this.listadoCoches.remove(cocheABorrar);		
	}

Última edición por javix3; 05/06/2009 a las 09:39