Question: Implement the following methods for an Arraylist in Java public void add(int index, E element) { // Add element at index. } public E remove(int
Implement the following methods for an Arraylist in Java
| public void add(int index, E element) { |
| // Add element at index. |
| } |
| public E remove(int index) { |
| // Remove the element at index. Make sure there are no gaps |
| // Return the removed element |
| } |
| public int indexOf(Object o) { |
| // Returns the index of the first occurrence of the specified element |
| // in this list, or -1 if this list does not contain the element. |
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
