Node inside a linkedlist
SomeInterface has an addLast() method that should add a node at the end of the list

public LinkedList<T> implements SomeInterface<T>{protected class Node<T>{
privateT data;
private Node<T> head,tail;
protected Node(T data,Node<T>tail){
this.data=data;head=null;this.tail=tail;}
private T getInfo(){return this.data;}
private void setTail(Node<T>newTail){this.tail=newTail;}
private void setLink(Node<T>newHead){this.head=newHead;}
private Node<T> getLink(){return tail;}
}}
public void addLast(){

}
}//end of LinkedList<T> class

when I create a LinkedList object (LinkedList<String>somelist=new LinkedList<T>()) and try to append multiple items (somelist.append("William");somelist.append("Fredk rick");somelist.append(Maria)) only the last item/string gets appended to the list. Any reason why?

Apart from the fact that the above code won't compile, nor run, you neglected to show HOW the append() method works, so we can't really help you there.

I'd have to venture a guess and say that you do not grow the linked list correctly, but that's impossible to be certain about without the actual code.

Here's code for the append method

Node<E>topNode=null;
append(E thing){
if(thing==null){throw new InvalidInputException();}
else{
    if(topNode==null){
        topNode=new Node<E>(thing,null);
        sizeCount++;return this;}
    if(topNode.tail==null){topNode.tail=new Node<E>(thing,null);return this;}
    else{topNode=topNode.tail;append(thing);return this;}
        }
       }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.