Linked List node class help!!
My instructor gave us an assignment that is supposed to support a Linked List that has two different trails of references. If you follow one trail of references it gives you the int values of the list in the order they were added and the other trail gives you the int values of the list in numeric order. I am supposed to just create a node class that will support the list, not create the list. Does this class do that or do I need more/different methods?
Code:
public class tlf0096DualNode {
private tlf0096DualNode link, sortLink;
private String data;
public tlf0096DualNode(){
data = null;
link = null;
sortLink = null;
}//end constructor
public tlf0096DualNode(String newData, tlf0096DualNode linkValue){
data = newData;
link = linkValue;
sortLink = null;
}//end method
public void setData(String newData){
data = newData;
}//end method
public String getData(){
return data;
}//end method
public void setLink(tlf0096DualNode newLink){
link = newLink;
}//end method
public void setSortLink(tlf0096DualNode newLink){
sortLink = newLink;
}
public tlf0096DualNode getLink(){
return link;
}//end method
public tlf0096DualNode getSortLink(){
return sortLink;
}
}//end class