Empty an array in Java / processing

后端 未结 8 1379
醉梦人生
醉梦人生 2020-11-27 19:05

Other than looping through each element in an array and setting each one to null, is there a native function in Java / processing to simply empty an array (or destroy it, to

8条回答
  •  Happy的楠姐
    2020-11-27 19:10

    If Array xco is not final then a simple reassignment would work:

    i.e.

    xco = new Float[xco .length];
    

    This assumes you need the Array xco to remain the same size. If that's not necessary then create an empty array:

    xco= new Float[0];
    

提交回复
热议问题