Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package fp; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.Map; import java.util.function. * ; import java.util.stream.Collectors; import java.util.List; class ExerciseNotCompletedException extends RuntimeException { public ExerciseNotCompletedException

package fp;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Map;
import java.util.function.*;
import java.util.stream.Collectors;
import java.util.List;
class ExerciseNotCompletedException extends RuntimeException {
public ExerciseNotCompletedException(){
super("Exercise is not completed yet");
}
}
/**
*{@link HW} is an exercise class. Each method returns a functional interface and it should be implemented
* using either lambda or a method reference. Every method that is not implemented yet throws
*{@link ExerciseNotCompletedException}.
*
* TODO: remove exception and implement each method of this class using lambda or method reference
*
/**
* Returns a {@link BiFunction} that has two parameters. First is {@link IntUnaryOperator} which is some integer function.
* Second is {@link IntPredicate} which is some integer condition. And the third is {@link IntUnaryOperator} which is
* a new composed function that uses provided predicate (second parameter of binary function) to verify its input
* parameter. If predicate returns {@code true} it applies a provided integer function
*(first parameter of binary function) and returns a result value, otherwise it returns an element itself.
*
* @return a binary function that receiver predicate and function and compose them to create a new function
*/
public static BiFunction functionToConditionalFunction(){
throw new ExerciseNotCompletedException();
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions