Auf Thema antworten

ich bringe mir alles bei was ich brauche, ich habe eben für das alles ganze aufgemischt.

Wieso klappt meine linkedlist nicht?


so ich habe die size Methode implementiert

[CODE=java]ublic class LinkedList< T extends Comparable<T>>{

    ListNode<T> first = null;

     LinkedList<T> liste = new LinkedList<T>();

  

        public void insert(ListNode<T> node) {

        if(node.value instanceof Comparable){

          

            Comparable wert = (Comparable) node.value;

          

          

        }

        node.setNext(first);

        first = node;

      

      

      

        int count = 0;

      

        size(first,count);

      

      

      


    }

    private void printList(ListNode<T> node, int count) {

        count++;

      

        System.out.println(count + " Index = " + node.getValue());

      

        if(node.getNext()!=null) printList(node.getNext(),count);


    }




    public void print(int count){


        printList(first,count);

      

  

      

      


    }

  

private int size(ListNode<T> node,int count) {

  count++;

 

 

  if(node.getNext()!=null) size(node.getNext(),count);

 

  return count;

 }

      

  

  

  

}

[/CODE]



Oben