Share via


Collections.Min Method

Definition

Overloads

Min(ICollection)

Returns the minimum element of the given collection, according to the natural ordering of its elements.

Min(ICollection, IComparator)

Returns the minimum element of the given collection, according to the order induced by the specified comparator.

Min(ICollection)

Returns the minimum element of the given collection, according to the natural ordering of its elements.

[Android.Runtime.Register("min", "(Ljava/util/Collection;)Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.Object & java.lang.Comparable<? super T>" })]
public static Java.Lang.Object Min (System.Collections.ICollection coll);
[<Android.Runtime.Register("min", "(Ljava/util/Collection;)Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.Object & java.lang.Comparable<? super T>" })>]
static member Min : System.Collections.ICollection -> Java.Lang.Object

Parameters

coll
ICollection

the collection whose minimum element is to be determined.

Returns

the minimum element of the given collection, according to the natural ordering of its elements.

Attributes

Remarks

Returns the minimum element of the given collection, according to the natural ordering of its elements. All elements in the collection must implement the Comparable interface. Furthermore, all elements in the collection must be mutually comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the collection).

This method iterates over the entire collection, hence it requires time proportional to the size of the collection.

Java documentation for java.util.Collections.min(java.util.Collection<? extends T>).

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

Min(ICollection, IComparator)

Returns the minimum element of the given collection, according to the order induced by the specified comparator.

[Android.Runtime.Register("min", "(Ljava/util/Collection;Ljava/util/Comparator;)Ljava/lang/Object;", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static Java.Lang.Object? Min (System.Collections.ICollection coll, Java.Util.IComparator? comp);
[<Android.Runtime.Register("min", "(Ljava/util/Collection;Ljava/util/Comparator;)Ljava/lang/Object;", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member Min : System.Collections.ICollection * Java.Util.IComparator -> Java.Lang.Object

Parameters

coll
ICollection

the collection whose minimum element is to be determined.

comp
IComparator

the comparator with which to determine the minimum element. A null value indicates that the elements' natural ordering should be used.

Returns

the minimum element of the given collection, according to the specified comparator.

Attributes

Remarks

Returns the minimum element of the given collection, according to the order induced by the specified comparator. All elements in the collection must be mutually comparable by the specified comparator (that is, comp.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the collection).

This method iterates over the entire collection, hence it requires time proportional to the size of the collection.

Java documentation for java.util.Collections.min(java.util.Collection<? extends T>, java.util.Comparator<? super T>).

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