Iterator implemented for linkedlist