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.
<T> | the class of the objects in the collection | |
coll | the collection whose minimum element is to be determined. |
ClassCastException | if the collection contains elements that are not mutually comparable (for example, strings and integers). | |
NoSuchElementException | if the collection is empty. |
Comparable
Diagram: Collections