niedziela, 11 września 2011

COLLECTIONS

1. Collections methods such as: sort(), binarySerach() or reverse() accepts only Lists not Sets.
Notice also that sort() and binarySerach() methods accept only Lists containing Comparable elements of the same type. If you try to sort lists containing non-comparable elements compilation fails. If the elements are of different types ClassCastException is thrown at runtime (unless you use your own Comparator).
To reverse order you do need have list of Comparable objects.

Brak komentarzy:

Prześlij komentarz