A generic class represents a potentially infinite set of subclasses of itself that are generated by supplying generic actual parameters for the class's generic formal parameters.
Each particular subclass of a generic class is only generated once, when it is first referenced.
Because a generic class is a bundle, it also represents a potentially infinite set of constructor functions generated in the same way. Invoking a generated constructor makes an instance of the generated subclass with the same generic actual parameters.
Distinct generated subclasses of a generic class never stand in a subtype relationship regardless of any subtype relationship among their generic actual parameters. (There is neither covariance nor contravariance.)
A generic class uses the same defining syntax as a regular class, except that the class name is followed by a generic formal parameter list enclosed in [ ] brackets.
For examples of generic classes, see Sequences
Previous page Table of Contents Next page