Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsUnmodifiableSortedMapExample3 { public static void main(String[] args) { SortedMap
map = new TreeMap<>(); map.put(1, "one"); map.put(2, "two"); System.out.println("Original Map: " + map); SortedMap
map2 = Collections.unmodifiableSortedMap(map); map2.remove(1); } }
Output