21. Collections Flashcards

1
Q

Although there are different kinds of collections, what particular convenience do they all have in common? (Collections API)

A

s

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

Name four methods from the Collection interface? Which collections have these methods?

A

s

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

What deficiency arguable exists in the use of interfaces as a means of contractual obligation?

A

s

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

What features characterize a collection as being a list?

A

s

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

What is the type parameter of a List used for?

A

s

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

What order does Lists: List interface: iterator() present the elements in?

A

s

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

If we have ArrayList al = new ArrayList(); what type is the object referenced by the variable al - is it ArrayList, List, Collection or Object?

A

ss

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

How is Lists: ArrayList collection implemented?

A

d

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

For which implementation of Lists will add(index) and remove(index) instance methods be slow, and for which will they be fast?

A

s

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

How is LinkedList collection implemented?

A

s

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

What features characterize a collection as being a map?

A

s

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

What are the type parameters of a Map interface used for?

A

s

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

How is the TreeMap collection implemented?

A

s

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

Howis the HashMap collection implemented?

A

d

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

What features characterize a collection as being a set?

A

s

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

What is the type parameter of a Set interface used for?

A

s

17
Q

What order does the Sets: Set interface: iterator() present the elements in?

A

s

18
Q

If we have HashSet hs = new HashSet(); what type is the object referenced by the variable hs - is it HashSet, Set, Collection or Object?

A

s

19
Q

How is the TreeSet collection implemented?

A

s

20
Q

What order does Sets: TreeSet: iterator() present the elements in?

A

s

21
Q

How is HashSet collection implemented?

A

s

22
Q

Name a generic class method that is provided in Collections class. What restrictions are placed on its List method argument?

A

s

23
Q

What two abstract methods does this have?

A

s

24
Q

What two stages are involved in this?

A

s

25
Q

What is data stored in at run time? What kinds of things might we want to do with such stored data?

A

s

26
Q

What is the consequence of clashes, and how is their occurrence minimized?

A

s

27
Q

Why is the data structure called OBT?

A

s

28
Q

For what circumstances is linked list better than using an array?

A

s

29
Q

What three instance methods does Integer have in order for it to behave properly in the collections classes?

A

s

30
Q

What is hashCode() used for, and what properties should it have?

A

s

31
Q

What properties must hashCode() have, and what property should it have? How can we achieve this?

A

s

32
Q

When should we use a for-each loop with collections?

A

s