public void print(Node<T> head){ Node<T> current = head; do{ System.out.println(current.getData()); current = current.getNext(); }while(head != current); }
public int size(Node<T> head){ Node<T> current = head; int count = 0; do{ count++; current = current.getNext(); }while(head != current); return count; }
public void generate(Node<T> head, List<T> list){ Node<T> temp; Node<T> current = head;
for(T t : list){ temp = new Node<T>(t); current.setNext(temp); current = temp; } current.setNext(head); }
public boolean checkOne(Node<T> head){ Node<T> current = head; int count = 0; do{ count++; current = current.getNext(); }while(head != current); if(count == 1){ return true; } return false; }
public Node<T> getNext() { return next; }
public void setNext(Node<T> next) { this.next = next; }
public long getCount() { return count; }
public void setCount(long count) { this.count = count; }