关于java列表移除的问题 [英] question on java list remove

查看:179
本文介绍了关于java列表移除的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该方法 公共布尔删除(对象o) 列表 从列表中删除的对象,但不following.Just归零对象值的元素转移。结果
IMHO,这是一uninintuitive设计的选择,因为该列表的前后除去保持相同的尺寸。结果,
有一种优雅的方式来获得与元素的列表转移?

The method public boolean remove(Object o) of List removes an object from list but does not shift the elements following.Just nulls the object value.
IMHO this is an uninintuitive design choice since the size of the list before and after removal remains the same.
Is there an elegant way to get a list with the elements shifted?

感谢

推荐答案

没有,这不是它做什么。该元素被删除,以下所有指数减1。是什么让你觉得它的作用不同?

No, that's not what it does. The element is removed and all indices following it are reduced by one. What makes you think it acts differently?

这篇关于关于java列表移除的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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