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