Java ArrayList替换特定索引 [英] Java ArrayList replace at specific index

查看:103
本文介绍了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) {

}


推荐答案

查看 set(int index,E element) 列表界面

这篇关于Java ArrayList替换特定索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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