0

I need help with an add boolean method in a singly linked list, The only difference is that i start off with a dummy head. The method's job is to add non-repeating objects to the linked list. Please help:

```
public boolean add(Object newData){
Node current = head.getNext();
Node v = new Node(newData, null);
tail = v;
if(current == null){//list is empty
head.setNext(v);
return true;
}
else{
while(current!= null){
if(newData != current.getElement()){
current = current.getNext();
current.setNext(v);
}
else return false;
}
}
return true;
```