import java.util.Calendar;
import java.util.Locale;
import java.util.Map;
import java.util.NavigableMap;
import java.util.TreeMap;
public class NavigableMapSample {
public static void main(String args[]) {
Calendar now = Calendar.getInstance();
Locale locale = Locale.getDefault();
Map names = now.getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
NavigableMap nav = new TreeMap(names);
System.out.printf("Whole list:%n%s%n", nav);
System.out.printf("Last key: %s\tLast entry: %s%n", nav.lastKey(), nav.lastEntry());
}
}