class ComparableNode<T extends Comparable<T>>
implements Comparable<ComparableNode<T>> {
private T data;
private ComparableNode<T> next;
public ComparableNode(T payload){
data=payload;
next=null;
}
public ComparableNode<T> getNext(){
return next;
}
public void setNext(ComparableNode<T> val){
next=val;
}
public T getData(){
return data;
}
public int compareTo(ComparableNode<T> other){
return data.compareTo(other.data);
}
}