package devmanuals.com; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.ConcurrentNavigableMap; public class CNMHeadMapInclusive { public static void main (String args[]){ ConcurrentNavigableMap cnm = new ConcurrentSkipListMap(); cnm.put(1,"A"); cnm.put(2,"B"); cnm.put(3,"C"); cnm.put(4,"D"); cnm.put(5,"E"); cnm.put(6,"F"); System.out.println("Mappings = "+cnm); System.out.println("Set of keys = "+cnm.keySet()); System.out.println("First entry of the map : "+cnm.firstEntry()); System.out.println("Last entry of the map : "+cnm.lastEntry()); cnm=cnm.headMap(5, true); System.out.println("Top elements of map upto key '5' = "+cnm); System.out.println("Size of map = "+cnm.size()); for(int i=0; i<=6;i++){ cnm.remove(3); } System.out.println("Remaining mappings of the map = "+cnm); cnm.putIfAbsent(3,"H"); System.out.println("Mapping after adding new element= "+cnm); } }