class NodeTest implements Comparable{ private String type; private int pos; NodeTest(String type, int pos){ this.type=type; this.pos=pos; } public String getType(){ return type; } public int getPos(){ return pos; } public String toString(){ return type+" "+pos; } public int compareTo(NodeTest other){ if(pos==other.getPos()){ return 0; }else if(pos>other.getPos()){ return 1; }else{ return -1; } } }