Java ArrayList 在特定索引处替换 [英] Java ArrayList replace at specific index
本文介绍了Java ArrayList 在特定索引处替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要这个java的帮助.我创建了一个灯泡 ArrayList,我试图用另一个灯泡替换特定索引处的灯泡.那么对于以下标题,我该如何进行?
I need help with this java please. I created an ArrayList of bulbs, and I'm trying to replace a bulb at specific index with another bulb. So with the following heading, how do I proceed?
public void replaceBulb(int index, Bulbs theBulb) {
}
推荐答案
查看列表界面
Check out the set(int index, E element)
method in the List interface
这篇关于Java ArrayList 在特定索引处替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文