overriding tailMap() method
Hello there,
This is my problem. I am working on a dictionary program using the TreeMap structure. I would like use the trailMap() method to get a subMap of higher keys and their values. But, I want to put a limit on the number of keys I am getting back. I have more than 2 thousands of entries in the TreeMap, so in theory I get 2 thousands key in the new subMap. I would like to limit it to around 30 entries.
I thought about three possible solutions: One, overriding the tailMap. I prefer to take that approach. However, I could not found the original implementation code. Can someone direct me to the actual code that produce tailMap (in Set, or Map)?
Second and third options, are to write my own tailMap method from start, or limit the capacity of the new SortedMap (getting from tailMap). Writing my own seems like the second best thing to do. I am not sure limiting the capacity, it seems waste of resources.
His someone has a good idea on which approach I should take?

