Quantcast
Channel: How can I create a generic array in Java? - Stack Overflow
Viewing all articles
Browse latest Browse all 66

Answer by Sam Ginrich for How to create a generic array in Java?

$
0
0

According to vnportnoy the syntax

GenSet<Integer> intSet[] = new GenSet[3];

creates an array of null references, to be filled as

for (int i = 0; i < 3; i++){   intSet[i] = new GenSet<Integer>();}

which is type safe.


Viewing all articles
Browse latest Browse all 66

Latest Images

Trending Articles



Latest Images