Skip to content

Instantly share code, notes, and snippets.

@Hikhuj
Created March 8, 2019 05:53
Show Gist options
  • Save Hikhuj/19ea80796ca634af5949010eac325639 to your computer and use it in GitHub Desktop.
Save Hikhuj/19ea80796ca634af5949010eac325639 to your computer and use it in GitHub Desktop.
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