This post originated from an RSS feed registered with Java Buzz
by Ram N.
Original Post: Java : Collection Framework : TreeMap (SubMap Inclusive)
Feed Title: JAVA EE
Feed URL: http://ramj2ee.blogspot.com/feeds/posts/default?alt=rss
Feed Description: This blog has viedo tutorials and Sample codes related to below Technologies.
1.J2EE
2.Java
3.Spring
4.Hibernate
5.Database
6.Oracle
7.Mysql
8.Design Patterns
/* * Example of subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) method. */ public class TreeMapExample { public static void main( String[] args ) {
/* * Returns a view of the portion of this map whose keys range from * fromKey to toKey. If fromKey and toKey are equal, the returned map is * empty unless fromInclusive and toInclusive are both true. The * returned map is backed by this map, so changes in the returned map * are reflected in this map, and vice-versa. The returned map supports * all optional map operations that this map supports. */ NavigableMap<Integer, String> navigableMap = treeMap.subMap(10, false, 40, false);
System.out .println("navigableMap [fromInclusive and toInclusive are both false] : " + navigableMap +"\n");