Collections Methods Flashcards

1
Q

Sorting (Ascending Sorting , Low -> High)

A

Collections.sort(list);

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

Reverse sorting (Descending Sorting , High -> Low)

A

Method 1 - Collections. sort (list,Collections.reverseOrder());
Method 2 - Collection.reverse(list);

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

Randomly Order a List’s Elements

A

Collections.shuffle();

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

Set every element of the list to a specified Object

A

Collections.fill(list,”Element”);

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

Copy the content of one list to another

A

Collections.copy(CopyList,OriginalList);

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

Find the Smallest Element in the list

A

Collections.min(list);

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

Find the Largest Element in the list

A

Collections.max(list);

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

Binary search of an element

A

Collections.binarySearch(List,key);

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

Frequency of an element in a List

A

Collections.frequency (List,”Element”);

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

Determine whether two list have any element common or not - Returns Boolean

A

Collections.disjoint(list1,list2);

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