且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java,按对象获取ArrayList索引

更新时间:2023-11-18 22:12:34

为什么不简单地使用this.name?
因为你已经拥有了这个对象为什么你需要让索引再次获取对象?

why don't you simply use this.name? As you already have the object why do you need to get the index to again get the object?

编辑:

要回答标题中的问题(获取对象的索引),请使用 indexOf

To answer the question in the title(to get index of the object) use indexOf