Syntax

Interface and class headers can now be declared as parameterized. Class declarations of parameterized types use the following syntax:
class Set[[E]] where E { boolean equals(E);
                         String toString(); }
{
   public Set() { ... }
   public addElement(E element) { ... }
   public E pickElement() { ... }
}
In this example, the class Set is defined to take one parameter, E. The where clause stipulates that any type used to instantiate Set must implement methods matching the signatures provided. Other code might refer to instantiations of this class, such as Set[[Integer]], or Set[[Object]].
class Map[[K,V]] where K { boolean equals(K key);
                           byte getHashByte(); }
                 where V { boolean equals(V); }
                 extends Dictionary[[K,V]]
                 implements Cloneable
...
Here, Map is defined to take two parameters. Note that naming arguments in where clauses is strictly optional; any argument names provided are ignored. Note also that {where clauses must precede the class's {\sf extends} and {\sf implements} clauses, if any.

Finally, note that parameters may be constrained to have constructors and static methods with certain required signatures:

class Generator[[N]] where N { N(int);
                               static boolean compare(N, N); }
To use parameterized classes, use their full instantiated types in field declarations and new calls. In other words, to indicate a set of Integer, one would write Set[[Integer]].
Note: Primitive types cannot yet be used as parameters.
   // ...
   Set[[Integer]] s = new Set[[Integer]]();
   s.addElement(new Integer(5));
   // ...
   Map[[Integer,String]].staticField = 123;
   Map[[Integer,String]].staticFunction();
Note that static members exist on a per-instantiation basis, rather than on a per-class basis. For example, Map[[Integer,String]].staticField is a difference variable from Map[[Integer,Integer]].staticField.