What Is Bounded Quantification?
Bounded quantification is a generics feature that limits a type parameter to types satisfying a stated bound, such as being a subtype of a class or implementing an interface. Within the generic code, values of that parameter can safely use the members the bound promises. It combines the flexibility of generics with guaranteed shared capabilities.
Why it matters
Bounds let generic code call methods on its type parameter while still accepting many concrete types. They are how constraints like "any type that is comparable" are expressed safely.
Related guides
What Is Variance in Type Systems?Variance describes how subtyping between type arguments carries over to subtyping between the generic types b…
What Is Covariance?Covariance preserves subtyping direction, so a generic over a subtype is a subtype of the same generic over a…
What Is Monomorphization?Monomorphization compiles generic code into a separate specialized copy for each concrete type it is used wit…