Code For NonGeek
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Deleting Elements from List

Go down

Deleting Elements from List Empty Deleting Elements from List

Post  Admin Fri Aug 26, 2011 12:20 pm

public boolean delete(ListNode head, Object a){
ListNode element=head;
if(element==null)
return false;
if(element.equals(a)){
head=element.next;
return true;
}
else{
while(element){
if(element.next.equals(a)){
element.next=a.next;
return true;
}
element=element.next;
}
return false;
}
}

Admin
Admin

Posts : 131
Join date : 2011-08-16

https://codefornongeek.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum