Last active
February 16, 2019 04:21
-
-
Save Hikhuj/fb6441f0038e8355ccf96a3c15202411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lista l = new Lista(); | |
l.inserta(new Pelicula("Blanca N", "Director1", 180, 1980)); | |
l.inserta(new Pelicula("Batman", "Director2", 190, 1995)); | |
l.inserta(new Pelicula("The Matrix", "Director1", 200, 2001)); | |
l.inserta(new Pelicula("Thor", "Director4", 150, 2001)); | |
l.inserta(new Pelicula("Avengers", "Director1", 180, 2010)); | |
l.inserta(new Pelicula("Ban", "Director1", 180, 2019)); | |
l.inserta(new Pelicula("CerCo", "Director2", 190, 1980)); | |
l.inserta(new Pelicula("Animalia", "Director1", 200, 1900)); | |
l.inserta(new Pelicula("XX", "Director4", 150, 2008)); | |
l.inserta(new Pelicula("The following", "Director1", 180, 1980)); | |
public void elimina(int anio) { | |
Nodo aux = cabeza; | |
if(anio == aux.getDato().getAnios()){ | |
cabeza = aux.getNext(); | |
aux = null; | |
}else{ | |
while(aux.getNext() != null) { | |
if(anio == aux.getNext().getDato().getAnios() && aux.getNext().getNext() != null){ | |
Nodo tmp = aux.getNext().getNext(); | |
aux.setNext(tmp); | |
}else{ | |
if(anio == aux.getNext().getDato().getAnios() && aux.getNext().getNext() == null){ | |
aux.setNext(null); | |
}else{ | |
aux = aux.getNext(); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment