I've got a program that is supposed to mimic a music playlist by implementing a circular, doubly linked list. However, i cant use java's LinkedList, i have to write my own linked list. I have a DblListnode class to keep track of the nodes (show below)
public class DblListnode {
private DblListnode prev;
private Object data;
private DblListnode next;
public DblListnode() {
this(null, null, null);
}
public DblListnode(Object d) {
this(null, d, null);
}
public DblListnode(DblListnode p, Object d, DblListnode n) {
prev = p;
data = d;
next = n;
}
public Object getData() {
return data;
}
public DblListnode getNext() {
return next;
}
public Object getPrev() {
return prev;
}
public void setData(Object ob) {
data = ob;
}
public void setNext(DblListnode n) {
next = n;
}
public void setPrev(DblListnode p) {
prev = p;
}
}
my Playlist class is supposed to have a field of type DblListnode that references the node representing the current song. How can i associate these two things together to get my custom circular doubly linked list? (I have a interface called SequenceADT that has methods such as forward() backward() and getCurrent(), but not sure if they are needed here)