Question: In this problem we'll add a firstNotEqualsLast method to our existing SimpleArrayList class. Create a public class FirstNotEqualsLast that extends SimpleArrayList. Provide an instance method
In this problem we'll add a firstNotEqualsLast method to our existing SimpleArrayList class.
Create a public class FirstNotEqualsLast that extends SimpleArrayList. Provide an instance method firstNotEqualsLast that returns true if the first item in the list does not equal the last item, and false otherwise. If the list is empty, 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 is empty, 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
