Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsSynchronizedSortedMapExample2 { public static void main(String[] args) { SortedMap
map = new TreeMap<>(); map.put(1, 1001); map.put(2, 1002); map.put(5, 1005); map.put(4, 1004); map.put(3, 1003); //System.out.println("Map before Synchronized map: " + map); SortedMap
synmap = Collections.synchronizedSortedMap(map); System.out.println("Synchronized sorted map:" + synmap); } }
Output