ConcurrentSkipListMap
implements ConcurrentNavigableMap. The map is sorted according to
the natural ordering of its keys, or by a Comparator provided at map
creation time, depending on which constructor is used.
This class implements a concurrent variant of SkipLists providing expected average log(n) time cost for the containsKey, get, put and remove operations and their variants. Insertion, removal, update, and access operations safely execute concurrently by multiple threads.
To know about skip lists, follow the below link.
https://self-learning-java-tutorial.blogspot.com/2014/09/skip-lists.html
This class implements a concurrent variant of SkipLists providing expected average log(n) time cost for the containsKey, get, put and remove operations and their variants. Insertion, removal, update, and access operations safely execute concurrently by multiple threads.
To know about skip lists, follow the below link.
https://self-learning-java-tutorial.blogspot.com/2014/09/skip-lists.html
import java.util.concurrent.ConcurrentNavigableMap; import java.util.concurrent.ConcurrentSkipListMap; public class ConcurrentSkipListMapEx { 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}
No comments:
Post a Comment