Java Certifications
www.javacertifications.com
 home  scjp1.5  scjp1.6  scwcd 1.5  scjp 1.5 questions  scjp 1.6 questions  scwcd 1.5 questions  scjp 1.5 success kit  scjp 1.6 success kit  
  JavaCertifications.net provides java certfication tutorials and mock questions.  


Bookmark and Share |||     Share   
805 scjp 1.6 questions with explanations ||| 788 scjp 1.5 questions with explanations ||| 650 SCWCD 5.0 questions with explanations

Tutorials


SCJP : NavigableMap

public interface NavigableMap
extends SortedMap
A SortedMap extended with navigation methods returning the closest matches for given search targets.


A NavigableMap may be accessed and traversed in either ascending or descending key order.


This interface additionally defines methods firstEntry, pollFirstEntry, lastEntry, and pollLastEntry that return and/or remove the least and greatest mappings, if any exist, else returning null.


NavigableMap use key value pairs to put the value.
import java.util.NavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;


public class Test {

public static void main(String... args) {
        
		
		NavigableMap navMap = new ConcurrentSkipListMap();
		
		navMap.put(4, "April");
		navMap.put(5, "May");
		navMap.put(6, "June");
		navMap.put(1, "January");
		navMap.put(2, "February");
		navMap.put(3, "March");

        System.out.print(navMap.firstEntry());
        System.out.print(navMap.lastEntry());
        System.out.print(navMap.get(6));


	     	      
	}
}
					
The output:
1=January
6=June
June			
					
scjp 1.5 | scjp 1.6 | scwcd 1.5
Java Certifications
www.javacertifications.net