I have a keysWithPrefix method for the purpose of returning all keys that start with an input value that is specified as in the implementation below:
public Iterable<String> keysWithPrefix(String pre) {
Queue<String> q = new Queue<String>() {
collect(get(root, pre, 0), pre, q);
return q;
}
private void collect(Node x, String pre, Queue<String> q) {
if (x == null) return;
if (x.val != null) q.add(pre);
for (char c = 0; c < R; c++)
collect(x.next[c], pre + c, q);
}
But I do not know how to print the return on screen. This method returns an Iterable string