Search:

Type: Posts; User: danthegreat

Search: Search took 0.12 seconds.

  1. Replies
    12
    Views
    3,181

    Re: LinkedList RemoveAll Method

    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...
  2. Replies
    12
    Views
    3,181

    Re: LinkedList RemoveAll Method

    public class ListNode {
    private Object value;
    private ListNode next;

    public ListNode(Object v, ListNode n){
    value=v;
    next=n;
    }

    public void setValue(Object v){
  3. Replies
    12
    Views
    3,181

    Re: LinkedList RemoveAll Method

    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...
  4. Replies
    12
    Views
    3,181

    Re: LinkedList RemoveAll Method

    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...
  5. Replies
    12
    Views
    3,181

    Re: LinkedList RemoveAll Method

    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...
  6. Replies
    12
    Views
    3,181

    LinkedList RemoveAll Method

    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...
Results 1 to 6 of 6