Collections.CheckedSortedMap(IDictionary, Class, Class) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a dynamically typesafe view of the specified sorted map.
[Android.Runtime.Register("checkedSortedMap", "(Ljava/util/SortedMap;Ljava/lang/Class;Ljava/lang/Class;)Ljava/util/SortedMap;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "K", "V" })]
public static System.Collections.IDictionary CheckedSortedMap (System.Collections.IDictionary m, Java.Lang.Class keyType, Java.Lang.Class valueType);
[<Android.Runtime.Register("checkedSortedMap", "(Ljava/util/SortedMap;Ljava/lang/Class;Ljava/lang/Class;)Ljava/util/SortedMap;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "K", "V" })>]
static member CheckedSortedMap : System.Collections.IDictionary * Java.Lang.Class * Java.Lang.Class -> System.Collections.IDictionary
Parameters
the map for which a dynamically typesafe view is to be returned
- keyType
- Class
the type of key that m
is permitted to hold
- valueType
- Class
the type of value that m
is permitted to hold
Returns
a dynamically typesafe view of the specified map
- Attributes
Remarks
Returns a dynamically typesafe view of the specified sorted map. Any attempt to insert a mapping whose key or value have the wrong type will result in an immediate ClassCastException
. Similarly, any attempt to modify the value currently associated with a key will result in an immediate ClassCastException
, whether the modification is attempted directly through the map itself, or through a Map.Entry
instance obtained from the map's Map#entrySet() entry set
view.
Assuming a map contains no incorrectly typed keys or values prior to the time a dynamically typesafe view is generated, and that all subsequent access to the map takes place through the view (or one of its collection views), it is guaranteed that the map cannot contain an incorrectly typed key or value.
A discussion of the use of dynamically typesafe views may be found in the documentation for the #checkedCollection checkedCollection
method.
The returned map will be serializable if the specified map is serializable.
Since null
is considered to be a value of any reference type, the returned map permits insertion of null keys or values whenever the backing map does.
Added in 1.5.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.