// TreeMap-headm1.jsl
// TreeMap.headMap example
import java.util.*;
public class MyClass
{
public static void main(String[] args)
{
// Create a TreeMap object:
TreeMap tm = new TreeMap();
// Add some elements:
tm.put("1","Sally Abolrous");
tm.put("3","Craig Combel");
tm.put("5","Pille Mandla");
// Display the headMap:
System.out.println("The head map is:\n" + tm.headMap("5"));
}
}
/*
Output:
The head map is:
{1=Sally Abolrous, 3=Craig Combel}
*/