ArrayUtils.removeElement与ArrayUtils.remove

use*_*738 -2 java arrays

有什么区别

ArrayUtils.removeElement

ArrayUtils.remove

Jef*_*eff 6

根据文件,

去掉:

Removes the element at the specified position from the specified array.
Run Code Online (Sandbox Code Playgroud)

例:

ArrayUtils.remove(['a'], 0)           = []
ArrayUtils.remove(['a', 'b'], 0)      = ['b']
ArrayUtils.remove(['a', 'b'], 1)      = ['a']
ArrayUtils.remove(['a', 'b', 'c'], 1) = ['a', 'c']
Run Code Online (Sandbox Code Playgroud)

removeElement:

Removes the first occurrence of the specified element from the specified array.
Run Code Online (Sandbox Code Playgroud)

例:

ArrayUtils.removeElement(null, 'a')            = null
ArrayUtils.removeElement([], 'a')              = []
ArrayUtils.removeElement(['a'], 'b')           = ['a']
ArrayUtils.removeElement(['a', 'b'], 'a')      = ['b']
ArrayUtils.removeElement(['a', 'b', 'a'], 'a') = ['b', 'a']
Run Code Online (Sandbox Code Playgroud)