class SinglyLinkedListNode<E>{
public E data;
public SinglyLinkedListNode<E> next;
public SinglyLinkedListNode(E data){
this.data = data;
this.next = null;
}
public void addNode(SinglyLinkedListNode<E> node){
SinglyLinkedListNode temp = this.next;
this.next = node;
node.next = temp;
}
}
class Solution{
public static SinglyLinkedListNode<Integer> doubleEvenNumber(SinglyLinkedListNode<Integer> head){
int count = 0;
SinglyLinkedListNode<Integer> iterator = head;
while(iterator != null){
SinglyLinkedListNode<Integer> currentNode = iterator;
iterator = iterator.next;
if ( count%2 == 0){
currentNode.addNode(new SinglyLinkedListNode<Integer>(currentNode.data * 2));
}
count++;
}
return head;
}
}