Java ArrayList replace at specific index

user949902 picture user949902 · Sep 17, 2011 · Viewed 278.7k times · Source

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) {

}

Answer

TotoroTotoro picture TotoroTotoro · Sep 17, 2011

Check out the set(int index, E element) method in the List interface