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\"
First of all, here is the full error (which is specific to MathSubset not getting a proper parameter): Bound mismatch: The type S is not a valid substitute for the bounded parameter
The problem is that MathSubset expects a , but you're giving it a S extends Solution> - those types having nothing to do with each other, because a Solution does not inherit or implement Comparable.
If anything, you could try this:
public class SolutionsSubset> extends
MathSubset implements Solutions>;
Unfortunately, this will STILL not work because MathSubset implements Iterable, but so does Solutions.
An easy fix would be for Solutions to not extend Iterable, but it really sounds to me like you're trying to use a more complex approach than you need to. May be a "has-a" instead of "is-a" design might be more beneficial here?