hi,
i am working with doubly linked lists in Java. i have an interface List, and classes NodeSequence and NodeList.

currently NodeList implements List, and NodeSequence extends NodeList.

what i need to do is make the doubly linked list CIRCULAR.
my understanding is that when we get to the last node, we want to point back to the first node instead of null. similarly when we get to the first node, going the other way, we want to point back to the last node. it all sounds simple enough, but i need to understand the actual code details better before i start changing around the existing code. here is a portion of NodeList that i think needs to be changed for sure:

public Position before(Position p)
throws InvalidPositionException, BoundaryViolationException
{
DNode v = checkPosition(p);
DNode prev = v.getPrev();
if (prev == header)
throw new BoundaryViolationException("Cannot advance past the beginning of the list");
return prev;
}

public Position after(Position p)
throws InvalidPositionException, BoundaryViolationException
{
DNode v = checkPosition(p);
DNode next = v.getNext();
if (next == trailer)
throw new BoundaryViolationException("Cannot advance past the end of the list");
return next;
}

anyways, any advice would be appreciated.
thanks.