且构网

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

Java,按对象获取 ArrayList 索引

更新时间:2023-11-18 22:43:52

为什么不直接使用 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