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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -