Answers for "java can you create generic arrays"

2

java generic array

public <T> T[] getArray(int size) {
    T[] genericArray = (T[]) new Object[size];
    return genericArray;
}
Posted by: Guest on April-10-2021
0

initialize generic array java

//It is recommended to use collections of generics because arrays of generics are a bit problematic in some cases
List<String>[] arrayOfList=(List<String>[])new List[100]();
Posted by: Guest on April-15-2021

Code answers related to "java can you create generic arrays"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language