Collection Flashcards

1
Q

Sorting Helpers

A

Collections.sort(List, Comparator)

Array.sort([], Comparator)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Comparable

A

public int compareTo(T other)

0 - both objects are equal
negative - This object is less than given object
positive - This object is greater than given object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Comparator

A

Interface to compare two objects.

public int compare(T ti, T t2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly