Aptean Interview Question

Implement Y linked list in Java. Code program to count all elements in a list without repeating any elements