copying array by value in java

前端 未结 5 1026
轻奢々
轻奢々 2020-12-19 00:42

I tried to make an independent copy of an array but couldnt get one. see i cannot copy it integer by integer using a for loop because of efficiency reasons. Is there any oth

5条回答
  •  猫巷女王i
    2020-12-19 01:01

    You can use System.arraycopy, but I doubt it will be much more efficient. The memory has to be copied anyways, so the only optimization possible is to copy bigger chunks of memory at once. But the size of a memory chunk copied at once is strongly limited by the processor/system-architecture.

提交回复
热议问题