Well, what do the methods insert, append and add look like?
What parameters are they expecting?
If it's an E then that's why you have to typecast.
An E is not (necessarily) a Comparable<E>.
Indeed, since that method needs a Comparable<E> then you should have defined the generic as (I think, my generics is rubbish) "<E extends Comparable<E>>" and not simply as "<E>".
No comments:
Post a Comment