共用方式為


TreeSet Constructors

Definition

Overloads

TreeSet()

Constructs a new, empty tree set, sorted according to the natural ordering of its elements.

TreeSet(IComparator)

Constructs a new, empty tree set, sorted according to the specified comparator.

TreeSet(ISortedSet)

Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.

TreeSet(ICollection)

Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.

TreeSet(IntPtr, JniHandleOwnership)

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

TreeSet()

Constructs a new, empty tree set, sorted according to the natural ordering of its elements.

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

Remarks

Constructs a new, empty tree set, sorted according to the natural ordering of its elements. All elements inserted into the set must implement the Comparable interface. Furthermore, all such elements must be mutually comparable: e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the set. If the user attempts to add an element to the set that violates this constraint (for example, the user attempts to add a string element to a set whose elements are integers), the add call will throw a ClassCastException.

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

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

TreeSet(IComparator)

Constructs a new, empty tree set, sorted according to the specified comparator.

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

Parameters

comparator
IComparator

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

Attributes

Remarks

Java documentation for java.util.TreeSet.TreeSet(java.util.Comparator<? super 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

TreeSet(ISortedSet)

Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.

[Android.Runtime.Register(".ctor", "(Ljava/util/SortedSet;)V", "")]
public TreeSet (Java.Util.ISortedSet? s);
[<Android.Runtime.Register(".ctor", "(Ljava/util/SortedSet;)V", "")>]
new Java.Util.TreeSet : Java.Util.ISortedSet -> Java.Util.TreeSet

Parameters

s
ISortedSet

sorted set whose elements will comprise the new set

Attributes

Remarks

Java documentation for java.util.TreeSet.TreeSet(java.util.SortedSet<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

TreeSet(ICollection)

Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.

[Android.Runtime.Register(".ctor", "(Ljava/util/Collection;)V", "")]
public TreeSet (System.Collections.ICollection? c);
[<Android.Runtime.Register(".ctor", "(Ljava/util/Collection;)V", "")>]
new Java.Util.TreeSet : System.Collections.ICollection -> Java.Util.TreeSet

Parameters

c
ICollection

collection whose elements will comprise the new set

Attributes

Remarks

Java documentation for java.util.TreeSet.TreeSet(java.util.Collection<? extends 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

TreeSet(IntPtr, JniHandleOwnership)

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

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

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