While looking over a source file, i saw two ways of array initialization. I wonder is there a difference between
int[] value = new int[0];
and<
There is no difference, although in the second case you have redundant []
.
Personally I prefer to use int[] value_next = {}
to create an empty array.
In my opinion, int[] value = new int[0];
can, on rapid reading, look like you're creating an array with one element in it with initial value of 0
. During a 3am debugging session I really appreciate clarity.