Wednesday, 17 September 2014

ConcurrentNavigableMap interface

ConcurrentNavigableMap is a ConcurrentMap supporting NavigableMap operations like ceilingEntry, ceilingKey, firstEntry, floorEntry, floorKey, higherEntry, higherKey, lastEntry, lowerEntry, lowerKey, pollFirstEntry, pollLastEntry etc.,

ConcurrentNavigableMap interface extends ConcurrentMap, NavigableMap interfaces.

import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;

public class ConcurrentNavigableMapEx {
    public static void main(String args[]){
        ConcurrentNavigableMap<Integer, String> map;
        
        map = new ConcurrentSkipListMap<> ();
        
        map.put(111, "Krishna");
        map.put(12, "Arjun");
        map.put(93, "Abdul");
        map.put(4, "jaideep");
        
        System.out.println(map.subMap(1, 15)); 
    }
}

Output
{4=jaideep, 12=Arjun}


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment