java - Generic Comparable gets a compiler error -


this question has answer here:

i have code:

private class tree<t implements comparable<t>> { } 

i expect put string objects tree, , string implements comparable, looked @ first glance.

but i'm getting error:

> expected private class tree<t implements comparable<?>> {                     ^ 

suggestions?

you need use

private class tree<t extends comparable<t>> { } 

Comments

Popular posts from this blog

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -