Online Java Compiler By
JavaTpoint.com
import java.util.*; public class CollectionsUnmodifiableNavigableMapExample3 { public static void main(String[] args) { NavigableMap
map = new TreeMap<>(); map.put(1, 1001); map.put(2, 1002); map.put(3, 1003); map.put(4, 1004); map.put(5, 1005); System.out.println("Initial map: " + map); NavigableMap
map2 = Collections.unmodifiableNavigableMap(map); map.remove(4, 1004); System.out.print("Unmodifiable navigable map after remove(4, 1004): "+map2); } }
Output