Share via


TreeMap Constructors

Definition

Overloads

TreeMap()

Constructs a new, empty tree map, using the natural ordering of its keys.

TreeMap(IComparator)

Constructs a new, empty tree map, ordered according to the given comparator.

TreeMap(IDictionary)

Constructs a new tree map containing the same mappings as the given map, ordered according to the <em>natural ordering</em> of its keys.

TreeMap(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

TreeMap()

Constructs a new, empty tree map, using the natural ordering of its keys.

[Android.Runtime.Register(".ctor", "()V", "")]
public TreeMap ();
Attributes

Remarks

Constructs a new, empty tree map, using the natural ordering of its keys. All keys inserted into the map must implement the Comparable interface. Furthermore, all such keys must be <em>mutually comparable</em>: k1.compareTo(k2) must not throw a ClassCastException for any keys k1 and k2 in the map. If the user attempts to put a key into the map that violates this constraint (for example, the user attempts to put a string key into a map whose keys are integers), the put(Object key, Object value) call will throw a ClassCastException.

Java documentation for java.util.TreeMap.TreeMap().

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

TreeMap(IComparator)

Constructs a new, empty tree map, ordered according to the given comparator.

[Android.Runtime.Register(".ctor", "(Ljava/util/Comparator;)V", "")]
public TreeMap (Java.Util.IComparator? comparator);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Comparator;)V", "")>]
new Java.Util.TreeMap : Java.Util.IComparator -> Java.Util.TreeMap

Parameters

comparator
IComparator

the comparator that will be used to order this map. If null, the Comparable natural ordering of the keys will be used.

Attributes

Remarks

Constructs a new, empty tree map, ordered according to the given comparator. All keys inserted into the map must be <em>mutually comparable</em> by the given comparator: comparator.compare(k1, k2) must not throw a ClassCastException for any keys k1 and k2 in the map. If the user attempts to put a key into the map that violates this constraint, the put(Object key, Object value) call will throw a ClassCastException.

Java documentation for java.util.TreeMap.TreeMap(java.util.Comparator<? super K>).

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

TreeMap(IDictionary)

Constructs a new tree map containing the same mappings as the given map, ordered according to the <em>natural ordering</em> of its keys.

[Android.Runtime.Register(".ctor", "(Ljava/util/Map;)V", "")]
public TreeMap (System.Collections.IDictionary m);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Map;)V", "")>]
new Java.Util.TreeMap : System.Collections.IDictionary -> Java.Util.TreeMap

Parameters

m
IDictionary

the map whose mappings are to be placed in this map

Attributes

Remarks

Constructs a new tree map containing the same mappings as the given map, ordered according to the <em>natural ordering</em> of its keys. All keys inserted into the new map must implement the Comparable interface. Furthermore, all such keys must be <em>mutually comparable</em>: k1.compareTo(k2) must not throw a ClassCastException for any keys k1 and k2 in the map. This method runs in n*log(n) time.

Java documentation for java.util.TreeMap.TreeMap(java.util.Map<? extends K, ? extends V>).

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

TreeMap(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected TreeMap (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Util.TreeMap : nativeint * Android.Runtime.JniHandleOwnership -> Java.Util.TreeMap

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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