I have two options and both have (afaik) the same output:
// 1
array = arrayList.toArray(new T[0]);
// 2
array = new T[arrayList.size()];
arrayList.toArray(array);
The first is shorter.
Is there any reason to use the second?
I have two options and both have (afaik) the same output:
// 1
array = arrayList.toArray(new T[0]);
// 2
array = new T[arrayList.size()];
arrayList.toArray(array);
The first is shorter.
Is there any reason to use the second?