Created
March 8, 2019 05:53
-
-
Save Hikhuj/19ea80796ca634af5949010eac325639 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
public void elimina(String nombre, String marca) { | |
Nodo aux = cabeza; | |
// Evaluar si AUX esta vacida | |
if(aux != null){ | |
// Evaluar si el primero cumple condicion | |
if(nombre.equals(aux.getDato().getNombre()) && marca.equals(aux.getDato().getMarca())){ | |
cabeza = aux.getNext(); | |
ultimo.setNext(cabeza); | |
}else{ | |
while(aux.getNext() != cabeza){ | |
if((aux.getNext() == ultimo) && (nombre.equals(aux.getNext().getDato().getNombre()) && marca.equals(aux.getNext().getDato().getMarca()))){ | |
ultimo = aux; | |
ultimo.setNext(cabeza); | |
}else{ | |
if(nombre.equals(aux.getNext().getDato().getNombre()) && marca.equals(aux.getNext().getDato().getMarca())){ | |
aux.setNext(aux.getNext().getNext()); | |
} | |
} | |
aux = aux.getNext(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment