import java.util.*;
import java.lang.*;
class Main
{
class LinkedList<Type>
{
private Node<Type> sentinel = new Node<Type>();
private Node<Type> current;
private int modCount;
{
// initialise instance variables
sentinel.setNext(sentinel);
sentinel.setPrev(sentinel);
modCount = 0;
}
public void prepend(Type newData)
{
Node<Type> newN = new Node<Type>(newData);
Node<Type> temp;
temp = sentinel.getPrev();
sentinel.setPrev(newN);
temp.setNext(newN);
newN.setPrev(temp);
newN.setNext(sentinel);
modCount++;
}
{
private int curPos, expectedCount;
private Node<Type> itNode;
{
curPos =0;
expectedCount = modCount;
itNode = sentinel;
}
public boolean hasNext()
{
return (curPos < expectedCount);
}
public Type next()
{
if (modCount != expectedCount)
if (!hasNext())
itNode = itNode.getNext();
curPos++;
current = itNode;
return (itNode.getData());
}
@Override
public void remove() {
// TODO Auto-generated method stub
}
}
private class Node<T> {
public Node(T newData) {
// TODO Auto-generated constructor stub
}
public Node<T> getPrev() {
// TODO Auto-generated method stub
return null;
}
public Node() {
// TODO Auto-generated constructor stub
}
public Node<T> getNext() {
return null;
}
public void setNext(Node<T> next) {}
public void setPrev(Node<T> next) {}
public T getData() {
// TODO Auto-generated method stub
return null;
}
}
}
{
}
}