Reputation: 45331
I would like your help in understanding what this syntax means:
class Node<K extends Comparable<? super K>, V>
What does the ?
stands for?
And isn't there one <
missing?
Upvotes: 1
Views: 655
Reputation: 308269
The ?
stands for "some unknown type". In this specific case it's ? super K
which means "some unknown type that's a base type of K
(i.e. "super class of" or "interface implemented by") .
And no, there's no <
missing: you have two <
and two >
, they match up.
Practically it means that Node
has two type arguments: K
which probably represents a key, which must be Comparable
to itself and V
which probably represents a value.
Upvotes: 9