Question: In this problem we'll add a firstEqualsThird method to our existing SimpleArrayList class. Create a public class FirstEqualsThird that extends SimpleArrayList. Provide an instance method
In this problem we'll add a firstEqualsThird method to our existing SimpleArrayList class.
Create a public class FirstEqualsThird that extends SimpleArrayList. Provide
an instance method firstEqualsThird that returns whether the first item in the list equals the third. If the list has less than three items, throw an IllegalArgumentException.
The SimpleArrayList class that you are extending stores the items as an Object values property, which you may access directly without using the normal setters or getters. Don't overthink this problem! values is just an array, and after you check whether it has the appropriate size, the solution is a single line of code.
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
