Collections Utility Class Flashcards

1
Q

Looks for the key in List. If found, returns a value >= 0; otherwise returns a negative value. It has an overloaded version that also takes a comparator object.

A

int binarySearch(List, key)

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

Copies all elements from src List to dst List.

A

void copy(dest, src)

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

Fills the whole List with the value obj.

A

void fill(List, obj)

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

Returns the max element in the list. Has an overloaded version that takes a comparator.

A

T max(Collection)

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

Returns the min element in the list. Has an overloaded version that takes a comparator.

A

T min(Collection)

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

Replaces all occurences of oldVal with newVal in the list.

A

boolean replaceAll(List, oldVal, newVal)

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

Reverses all the elements in the given list.

A

void reverse(List)

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

Rotates the list given by the value distance.

A

void rotate(List, int distance)

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

Shuffles the elements in the list randomly.

A

void shuffle(List)

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

Sorts the list in its natural order. Has an overloaded version that also takes a comparator object.

A

void sort(List)

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

Swaps the elements in the positions i and j in the list.

A

void swap(List, int i, int j)

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