Re: Bounded Type Parameters

Primitives don't take a part in the entire generics hoopla; try Integer instead.

kind regards,

Jos

Re: Bounded Type Parameters

doesn't work with Integer as well

Re: Bounded Type Parameters

The name of the interface is Comparable, not Compareble. Your IDE or compiler would've told you that, I'm sure, if only you would've read ...

kind regards,

Jos

Re: Bounded Type Parameters

still saying "Bound mismatch: The generic method countElements(T[], T) of type BoundedTypeMethods is not applicable for the arguments (Integer[], Integer). The inferred type Integer is not a valid substitute for the bounded parameter <T extends Comparable<T>>"

Re: Bounded Type Parameters

Uh, are you defining your own Comparable interface, if I have to believe your original post? Because Integer does not automatically implement YOUR Comparable interface, it implements the one built into the JDK.

Re: Bounded Type Parameters

Darn, I missed that interface definition completely; indeed Integer doesn't implement that Compareble interface; problem solved.

kind regards,

Jos

Re: Bounded Type Parameters

Actually it was written in Oracle Java tutorials ..... problem solved .. thanks josAh and gimbai2 :(y):

Re: Bounded Type Parameters

Ah but tutorials are not to be followed blindly, they are to be understood and interpreted.

Re: Bounded Type Parameters

implementation is also necessary ..

Re: Bounded Type Parameters

An Oracle tutorial writing 'Compareble'? I don't believe that ...

kind regards,

Jos

Re: Bounded Type Parameters