public void Insertar(Productos nuevo, int posicion) { int contador = 1; Productos temp = inicio; if (posicion == 1) { nuevo.siguiente = inicio; inicio = nuevo; } else { while (temp.siguiente != null && contador < posicion - 1) { temp = temp.siguiente; contador++; } nuevo.siguiente = temp.siguiente; nuevo.anterior = temp; nuevo.siguiente.anterior = nuevo; temp.siguiente = nuevo; } }
public void eliminarUltimo() { ultimo = ultimo.anterior; ultimo.siguiente = null; }
public void eliminarPrimero() { inicio = inicio.siguiente; }