Collections.CheckedNavigableSet(INavigableSet, Class) Method

Definition

Returns a dynamically typesafe view of the specified navigable set.

[Android.Runtime.Register("checkedNavigableSet", "(Ljava/util/NavigableSet;Ljava/lang/Class;)Ljava/util/NavigableSet;", "", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "E" })]
public static Java.Util.INavigableSet CheckedNavigableSet (Java.Util.INavigableSet s, Java.Lang.Class type);
[<Android.Runtime.Register("checkedNavigableSet", "(Ljava/util/NavigableSet;Ljava/lang/Class;)Ljava/util/NavigableSet;", "", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "E" })>]
static member CheckedNavigableSet : Java.Util.INavigableSet * Java.Lang.Class -> Java.Util.INavigableSet

Parameters

s
INavigableSet

the navigable set for which a dynamically typesafe view is to be returned

type
Class

the type of element that s is permitted to hold

Returns

a dynamically typesafe view of the specified navigable set

Attributes

Remarks

Returns a dynamically typesafe view of the specified navigable set. Any attempt to insert an element of the wrong type will result in an immediate ClassCastException. Assuming a navigable set contains no incorrectly typed elements prior to the time a dynamically typesafe view is generated, and that all subsequent access to the navigable set takes place through the view, it is <em>guaranteed</em> that the navigable set cannot contain an incorrectly typed element.

A discussion of the use of dynamically typesafe views may be found in the documentation for the #checkedCollection checkedCollection method.

The returned navigable set will be serializable if the specified navigable set is serializable.

Since null is considered to be a value of any reference type, the returned navigable set permits insertion of null elements whenever the backing sorted set does.

Added in 1.8.

Java documentation for java.util.Collections.checkedNavigableSet(java.util.NavigableSet<E>, java.lang.Class<E>).

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.

Applies to