Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider a modified version of the List ADT in which it has the member methods first Index & last Index implemented using Lambda Functions, the
Consider a modified version of the List ADT in which it has the member methods first Index \& last Index implemented using Lambda Functions, the signature to use for these new modified methods are as follows: - public int firstindex (FirstindexLambda>1 ); - public int lastindex(LastindexLambda 1 ) ; Where FirstIndexLambda> and LastIndexLambda are functional interfaces created to enable these methods to use said Lambda Functions. We'll also consider two new methods that will extend the functionality of the ADT. These two new methods are called filter \& map, and their signatures are as follows - public List E> filter (LambdaFilter E> 1) ; - Returns a new list with all the elements of the target list filtered down to just the elements that pass the test implemented by the provided Lambda Function. - Example: - A={1,2,3,4,5,6,7,8,9}; - A call to A. filter (num num >4 ); will return result ={5,6,7,8,9}; - public List E>map(LambdaMap1 ) ; - Returns a new list populated with the results of calling the provided Lambda Function on every element in the target list. - Example: - A={1,2,3,4,5}; - A call to Amap( num > num * 2 ); will return result ={2,4,6,8,10}; Where LambdaFilter E> and LambdaMap E> are functional interfaces created to enable these methods to use said Lambda Functions. Implement these four methods for the list ADT in which each of them use Lamba Functions. Note: Implementations that do not use Lambda Functions will receive zero points from the JUnit, you cannot use regular implementations as discussed in lectures. Hint: map() and filter () are greatly inspired by JavaScript Array methods, it may be useful to see how these methods work by searching for JavaScript documentation online
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started