Generics Array
Java does not permit the construction of generic array. Suppose, for example, that we want to design a class that has an array field
public class Table<AnyType>
{
private AnyType[] contents = new AnyType[5];
...
}
public class Table<AnyType>
{
private AnyType[] stack = (AnyType[]) new Object[5];
...
}source -http://www.cs.cmu.edu/~adamchik/15-121/lectures/Collections/collections.html
Comments
Post a Comment