Queue is an interface that implements many different classes. I am confused about why my text book gives this sample text using Queue. I have also found this in an example on the Princeton website. Is this a customary way to provide code so it can be edited later to the programmers preferred type of queue?
This is code taken from an algorithm for a Binary Search Symbol Table.
public Iterable<Key> keys(Key lo, Key hi) {
    Queue<Key> q = new Queue<Key>();
    for (int i = rank(lo); i < rank(hi); i++) {
        q.enqueue(keys[i]);
    }
    if (contains(hi)) {
        q.enqueue(keys[rank(hi)]);
    }
    return q;
}
 
     
     
     
    