Get lowest and highest key stored in TreeMap : TreeMap « Collections « Java Tutorial

Home
Java Tutorial
1.Language
2.Data Type
3.Operators
4.Statement Control
5.Class Definition
6.Development
7.Reflection
8.Regular Expressions
9.Collections
10.Thread
11.File
12.Generics
13.I18N
14.Swing
15.Swing Event
16.2D Graphics
17.SWT
18.SWT 2D Graphics
19.Network
20.Database
21.Hibernate
22.JPA
23.JSP
24.JSTL
25.Servlet
26.Web Services SOA
27.EJB3
28.Spring
29.PDF
30.Email
31.J2ME
32.J2EE Application
33.XML
34.Design Pattern
35.Log
36.Security
37.Apache Common
38.Ant
39.JUnit
Java Tutorial » Collections » TreeMap 
9.29.8.Get lowest and highest key stored in TreeMapPrevious/Next
import java.util.TreeMap;

public class Main {
  public static void main(String[] args) {
    TreeMap<String, String> treeMap = new TreeMap<String, String>();
    treeMap.put("1""One");
    treeMap.put("2""Two");
    treeMap.put("3""Three");    
    treeMap.put("4""Four");
    treeMap.put("5""Five");

    System.out.println("Lowest key: " + treeMap.firstKey());
    System.out.println("Highest key: " + treeMap.lastKey());
  }
}
9.29.TreeMap
9.29.1.TreeMap Class
9.29.2.Viewing Sub Maps
9.29.3.Working with End Points
9.29.4.Get Synchronized Map from TreeMap
9.29.5.Check if a particular key exists in TreeMap
9.29.6.Check if a particular value exists in TreeMap
9.29.7.Get Head Map from TreeMap
9.29.8.Get lowest and highest key stored in TreeMap
9.29.9.Get Set view of Keys from TreeMap
9.29.10.Get TreeMap Size
9.29.11.Get Sub Map from TreeMap
9.29.12.Get Tail Map from TreeMap
9.29.13.Iterate through the values of TreeMap
9.29.14.Remove all values from TreeMap
9.29.15.Remove value from TreeMap
9.29.16.TreeMap
9.29.17.Cache Map
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.