// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.Map.Entry;

public class Searching {
    public static void main(String[] args) {
        TreeMap<String,Integer> h = new TreeMap<String,Integer>();
        h.put("hello", new Integer(1));
        h.put("hell", new Integer(2));
        h.put("alpha", new Integer(3));
        h.put("bye", new Integer(4));
        h.put("hello2", new Integer(5));
        h.put("solly", new Integer(6));
        h.put("sally", new Integer(7));
        h.put("silly", new Integer(8));
        h.put("zorro", new Integer(9));
        h.put("hi", new Integer(10));
        SortedMap<String, Integer> h2 = h.subMap("h", "i");
        for(Entry<String,Integer> e : h2.entrySet()) {
            System.out.println(e.getKey() + " " + e.getValue());
        }
   }
}
