Question: Add a method void replaceAll ( int oldVal, int newVal ) to the IntegerList class thatreplaces all occurrences of oldVal in the list with newVal.

Add a method void replaceAll(int oldVal, int newVal) to the IntegerList class thatreplaces all occurrences of oldVal in the list with newVal. If oldVal does not appear in list, it shoulddo nothing (but it's not an error). Does it still make sense to use the search method like you did forreplaceFirst, should you do your own searching here, or should you repeatedly use another method?Think about this.Add an option to the menu in IntegerListTest to test your new method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!