Java eqivalent method of “splice(a,b,…)” in JavaScript method

后端 未结 6 886
伪装坚强ぢ
伪装坚强ぢ 2021-01-20 01:22

someArray.splice(a,b,...) method in JavaScript adds or removes items to/from array. What could be good and simple solution to implement such method in Java lang

6条回答
  •  粉色の甜心
    2021-01-20 01:42

    Java arrays have a fixed length, so this cannot be done directly.

    If you want to combine two arrays, look at this answer.

    If you want to add to the array, you should use a List or an ArrayList instead.

提交回复
热议问题