About error using Java generics: “type parameter S is not within its bound”

前端 未结 3 961
傲寒
傲寒 2020-12-20 14:06

I am writing some classes using Generics but I can\'t find a solution for the class SolutionsSubset and so I a getting the error \"type parameter S is not within its bound\"

3条回答
  •  时光说笑
    2020-12-20 14:42

    Generics are something that can quickly get out of hand, especially if you try to "be all generic" all at once. Less is more. What always helps me is to start concrete (including the implementation) and then slowly substitute generic parameters in, one parameter and class at a time.

    Could anybody help me to improve my knowledge about generics?

    http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html

    Not a tutorial, but lots of useful info. Its one of those references that you read the parts you can understand, but come back to over and over again in the future as you gain more mastery and more of it begins to make sense.

提交回复
热议问题