从int arraylist中删除一个int元素 [英] remove an int element from an int arraylist

查看:103
本文介绍了从int arraylist中删除一个int元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我希望从我的int arraylist中删除一个int元素,我尝试过.remove方法但它不起作用。





示例:[34,0]





从arraylist中删除元素0

Hi I wish to remove an int element from my int arraylist, I have tried .remove method but it does not work.


Example: [34, 0]


Remove the element 0 from the arraylist

推荐答案

请参阅以下对您有用的链接。





http://java67.blogspot.in/2012/12/how-to-remove- element-from-array-in-java-example.html [ ^ ]
Refer below link that is useful to you.


http://java67.blogspot.in/2012/12/how-to-remove-element-from-array-in-java-example.html[^]


为了使用arraylist的.remove方法删除整数class必须将索引作为参数传递。你可以试试.remove(.indexOf(0))。 .indexOf(0)将返回索引0。
In order to remove a integer using the .remove method of the arraylist class you have to pass the index as a parameter. You can try .remove(.indexOf(0)). .indexOf(0) will return the index of 0.


这篇关于从int arraylist中删除一个int元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆