How to iterate through a PORTION of a TreeMap?
I'm doing an assignment where I have to search through keys in a TreeMap (that are mapped to files that they are found in. Basically, this TreeMap is an Inverted Index) that start with a query word that we specify to the program in a query file. However, for efficiency purposes, my professor does not want is to iterate through ALL the keys in the TreeMap when we look for keys that start with the query words, rather she wants us to iterate through only the keys that we need to iterate through. For example, if the query word starts with C, then we should only iterate through the keys that start with C. Any ideas on how to approach this?
How to iterate through a PORTION of a TreeMap?
===

I'm doing an assignment where I have to search through keys in a TreeMap (that are mapped to files that they are found in. Basically, this TreeMap is an Inverted Index) that start with a query word that we specify to the program in a query file. However, for efficiency purposes, my professor does not want is to iterate through ALL the keys in the TreeMap when we look for keys that start with the query words, rather she wants us to iterate through only the keys that we need to iterate through. For example, if the query word starts with C, then we should only iterate through the keys that start with C. Any ideas on how to approach this?