public static < K , V , M extends SortedMap < K , V > > UnmodifiableTreeMap < K , V > of ( M map ) { if ( map == null ) { throw new IllegalArgumentException ( "cannot create a UnmodifiableSortedMap for null" ) ; } return new UnmodifiableTreeMap < K , V > ( SortedMapAdapter . adapt ( map ) ) ; }
This method will take a MutableSortedMap and wrap it directly in a UnmodifiableMutableMap . It will take any other non - GS - SortedMap and first adapt it will a SortedMapAdapter and then return a UnmodifiableSortedMap that wraps the adapter .