Question: Add a method void replaceFirst ( int oldVal, int newVal ) to the IntegerList classthat replaces the first occurrence of oldVal in the list with
Add a method void replaceFirstint oldVal, int newVal to the IntegerList classthat replaces the first occurrence of oldVal in the list with newVal. If oldVal does not appear in list,it should do nothing but it's not an error If oldVal appears multiple times, only the first occurrenceshould be replaced. Note that you already have a search method to find oldVal in the list; use it
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
