void addPrevious(Node<T> n){
  prevNodes.add(n);
  Collections.sort(prevNodes,isVertical ? verticalComparator : horizontalComparator);
}

void addPrevious ( Node < T > n ) { prevNodes . add ( n ) ; Collections . sort ( prevNodes , isVertical ? verticalComparator : horizontalComparator ) ; }
addes a node as one of the previous nodes .
