Aracılığıyla paylaş


Collections.Max Method

Definition

Overloads

Max(ICollection, IComparator)

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

Max(ICollection)

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

Max(ICollection, IComparator)

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

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

Parameters

coll
ICollection

the collection whose maximum element is to be determined.

comp
IComparator

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

Returns

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

Attributes

Remarks

Returns the maximum 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.max(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

Max(ICollection)

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

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

Parameters

coll
ICollection

the collection whose maximum element is to be determined.

Returns

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

Attributes

Remarks

Returns the maximum 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.max(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