Quantcast
Channel: How can I create a generic array in Java? - Stack Overflow
Viewing full articles (66 articles)
Browse article index
↧

Answer by Pedram Esmaeeli for How can I create a generic array in Java?

$
0
0

Actually an easier way to do so, is to create an array of objects and cast it to your desired type like the following example:

T[] array = (T[])new Object[SIZE];

where SIZE is a constant and T is a type identifier

↧

Viewing full articles (66 articles)
Browse article index

Latest Images

Trending Articles



Latest Images