Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsUnmodifiableSortedMapExample1 { public static void main(String[] args) { SortedMap
map = new TreeMap
(); map.put(1, 1001); map.put(4, 1004); map.put(2, 1002); map.put(3, 1003); System.out.println("Original Map: " + map); SortedMap
map2 = Collections.unmodifiableSortedMap(map); map.put(5, 1005); System.out.println("Unmodifiable Sorted Map: " + map2); } }
Output