Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please take a look at the todo part and help with the following code! Thank you so much! package fp; import java.math.BigDecimal; import java.util.ArrayList; import

Please take a look at the todo part and help with the following code! Thank you so much!
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 an {@link IntUnaryOperator} that receives an int as a bound parameter, and returns a random int
*
* @return int operation
*/
public static IntUnaryOperator boundedRandomIntSupplier(){
throw new ExerciseNotCompletedException();
}
/**
* Returns {@link IntUnaryOperator} that calculates an integer square
*
* @return square operation
*/
public static IntUnaryOperator intSquareOperation(){
throw new ExerciseNotCompletedException();
}
/**
* Returns a {@link LongBinaryOperator} sum operation.
*
* @return binary sum operation
*/
public static LongBinaryOperator longSumOperation(){
throw new ExerciseNotCompletedException();
}
/**
* Returns a {@link ToIntFunction} that converts string to integer.
*
* @return string to int converter
*/
public static ToIntFunction stringToIntConverter(){
throw new ExerciseNotCompletedException();
}
/**
* Receives int parameter n, and returns a {@link Supplier} that supplies {@link IntUnaryOperator}
* that is a function f(x)= n * x
*
* @param n a multiplier
* @return a function supplier
*/
public static Supplier nMultiplyFunctionSupplier(int n){
throw new ExerciseNotCompletedException();
}
/**
* Returns a {@link UnaryOperator} that accepts str to str function and returns the same function composed with trim
*
* @return function that composes functions with trim() function
*/
public static UnaryOperator> composeWithTrimFunction(){
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_2

Step: 3

blur-text-image_3

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Discuss the key people management challenges that Dorian faced.

Answered: 1 week ago

Question

How fast should bidder managers move into the target?

Answered: 1 week ago