Thanks for the comments Norm and andreas90.
@andreas -- shouldn't 'current=current.getNext()' eventually equal null since the last element in the linkedlist has a next of 'null' so after the last...
Type: Posts; User: danthegreat
Thanks for the comments Norm and andreas90.
@andreas -- shouldn't 'current=current.getNext()' eventually equal null since the last element in the linkedlist has a next of 'null' so after the last...
public class ListNode {
private Object value;
private ListNode next;
public ListNode(Object v, ListNode n){
value=v;
next=n;
}
public void setValue(Object v){
ok here is the program:
public class MyLinkedList {
//refers to first node in the linked list
private ListNode front;
//default constructor (initializes the front of the list to...
What do you mean? What I posted above causes an infinite loop for some reason. Nothing about nullpointerexception occurs anymore. This is what is in my driver method:
public static void...
Well I actually printed the variable and current remains null constantly so in my mind....so I suppose that is what causing nullpointer, however when I add a try catch block, the loop runs...
Hi guys,
I am having a problem with my linkedlist class. I am making it from scratch and I want the removeAll method to remove all occurences of item from the linked list. If item is not...