20. Interfaces, including generic interfaces Flashcards

1
Q

What is perhaps surprising about the way we say that a type argument of a generic class or interface or generic method, must implement a particular interface?

A

s

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

What are the three components of a type? In what way does a class have these things?

A

s

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

What typical trade-off is being shown when we compare this with the simplest way of searching a list?

A

s

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

What is the instance method that implements a total order in Java typically called? What parameters does it take and what result does it produce?

A

s

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

Which of the following, if any, are examples of multiple inheritance?

  1. An instance of class A is a B and has a C.
  2. An instance of class A is a B and also is a C, but B is not a C nor vice versa.
  3. An instance of class A is a B which in turn is a C.
  4. An instance of class A has a B and is a C
A

d

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

What is the main difference between an interface and a class? What can interfaces not contain?

A

s

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

Which of the three components of a type are provided by an interface, and which are provided by the classes that implement the interface?

A

s

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

What simple errors might we make, and what can we write to protect us from them?

A

s

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

If we do not supply type arguments for a generic interface when we use it, then what is it we are using?

A

s

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

How many other interfaces can an interface extend? How many classes can an interface extend?

A

s

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

How do we state that a class implements server interfaces?

A

s

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

When might we want to have a generic method rather than a generic class? How do we call a generic method - where do we write the type argument(s)? Do we actually have to write them anyway?

A

s

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

What do we mean by bound type parameter?

A

s

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

What is the purpose of Arrays class?

A

s

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

What must be true about the argument if it is an array of objects? (Arrays: sort())

A

s

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

What is Arrays: copyOf() especially useful for? What is its type parameter?

A

s

17
Q

What instance method must be provided by any non-abstract class, that implements the Comparable interface?

A

s

18
Q

What should be the relationship between compareTo() and equals() methods?

A

s

19
Q

What notion of equivalence is implemented in Object?

A

s

20
Q

Exactly what parameterization of Comparable does String implement?

A

s