Bounded Wildcards

Java-Bounded Wildcards

Bounded Wildcards A bounded wildcard is a wildcard that uses the extends keyword just as a type variable would to limit the range of assignable types. For example : Our ‘abc’ variable is limited to holding instantiations of Gen on parameter types of A and its subclasses(B and C). So, we can assign it a Gen<A> or … Read more…

Bounded Types

Java-Bounded Types

Bounded Types In some situations you define a generic type where you want to constrain the type arguments that are supplied to define a class instance so that they extend a particular class, or implement specific interfaces, or even both. The reason for this is that your generic type has to make some assumptions about … Read more…