Skip to main content

All Questions

1 vote
1 answer
228 views

Why doesn't Comparable<T> include any type bound? [closed]

Why do you think the definition of Comparable<T> lacks an upper bound on T? That is, why is it not defined as: Comparable<T extends Comparable<?>> or Comparable<T extends ...
Marco's user avatar
  • 337
4 votes
1 answer
128 views

The bound mechanism by generics for a type variable to appear in its own bound

From Programming Languages: Principles and Paradigms By Maurizio Gabbrielli, Simone Martini The bound mechanism for type variables is fairly sophisticated and flexible. In particular, a type ...
Tim's user avatar
  • 5,525
-2 votes
1 answer
313 views

What is an efficient way to implement 'Stack' without generics?

Today I was reading a lot of articles complaining about Java Generics or C++ Templates. Now, my question is: How can someone implement a collection data structure like Stack without using them?
Mahdi's user avatar
  • 189