java ArrayUtils.removeElement 与 ArrayUtils.remove

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36020059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 00:52:35  来源:igfitidea点击:

ArrayUtils.removeElement vs. ArrayUtils.remove

javaarrays

提问by user3776738

What is the difference between

之间有什么区别

ArrayUtils.removeElement

ArrayUtils.removeElement

and

ArrayUtils.remove

ArrayUtils.remove

?

?

回答by Jeff

According to the documentation,

根据文档

remove:

消除:

Removes the element at the specified position from the specified array.

example:

例子:

ArrayUtils.remove(['a'], 0)           = []
ArrayUtils.remove(['a', 'b'], 0)      = ['b']
ArrayUtils.remove(['a', 'b'], 1)      = ['a']
ArrayUtils.remove(['a', 'b', 'c'], 1) = ['a', 'c']

removeElement:

删除元素:

Removes the first occurrence of the specified element from the specified array.

example:

例子:

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']

回答by ferit

ArrayUtils.removeElement removes the first occurrence of the specified element from the specified array.

ArrayUtils.removeElement 从指定数组中删除第一次出现的指定元素。

ArrayUtils.remove removes the element at the specified position from the specified array.

ArrayUtils.remove 从指定数组中移除指定位置的元素。

Please refer: https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/ArrayUtils.html

请参考:https: //commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/ArrayUtils.html