Multiple constraints on a type parameter - design decision


#1

Hello

I wonder about grammar design decision. Now we are defining multiple constraints on a type parameter in such way:

//Code at the end (editor is removing angle brackets)

I wonder what is the point of introducing where keyword, since we could achieve the same result in much simple way (Similar to way we are implementing multiple interfaces in class)

//Code at the end (editor is removing angle brackets)

So the real question is what is the advantage of design it this way or what would not be possible without where keyword?


#2

I believe this was already answered: “The Java syntax doesn’t scale to other kinds of type parameter constraints […]”.

See this post: Why the scattered generic types?