×

Loading...

ten. Believe me, I am SCJP and SCWCD. Please read api as following:

newcomer1 (newcomer1)
max
public static Object max(Collection coll)
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.

Parameters:
coll - 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.
Throws:
ClassCastException - if the collection contains elements that are not mutually comparable (for example, strings and integers).
NoSuchElementException - if the collection is empty.
See Also:
Comparable
(#367354@0)
2002-2-13 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: 在学java, 有一个例子的结果不明白,请教.

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论