We could add a public printKeys method to BST:
public class BST<Key extends Comparable<Key>, Value> { /** * prints the keys to standard output in sorted order */ public void printKeys() { printKeys(root); } /** * prints the keys in the subtree t to standard output * in sorted order */ private void printKeys(Node t) { /** * if t is empty, return * print keys in the left subtree in sorted order * print t.key * print keys in the right subtree in sorted order */ } }