Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The basic generic functional interface ________ in package java.util.function co

ID: 3731662 • Letter: T

Question

The basic generic functional interface ________ in package java.util.function contains method test that takes a T argument and returns a boolean. Tests whether the T argument satisfies a condition.

Consumer<T>

Function<T,R>

Supplier<T>

Predicate<T>

1 points   

QUESTION 14

Stream method ________ maps objects to double values and returns a DoubleStream. The method receives an object that implements the functional interface ToDoubleFunction (package java.util.function).

doubleMap

toDouble

mapToDouble

toDoubleStream

1 points   

QUESTION 15

Collectors static method groupingBy with one argument receives a Function that classifies objects in the stream—the values returned by this function are used as the keys in a Map. The corresponding values, by default, are ________ containing the stream elements in a given category.

Lists

Arrays

Strings

Collectors

1 points   

QUESTION 16

Functional interface BiConsumer’s accept method has two parameters. For Maps, the first represents the ________ and the second the corresponding ________.

key, variable

lambda, value

lambda, variable

key, value

1 points   

QUESTION 17

Class Array’s ________ method is used to create a Stream from an array of objects.

stream

arrayToStream

createStream

objectToStream

1 points   

QUESTION 18

An ________ (package java.util.stream) is a specialized stream for manipulating int values.

StreamOfInt

IStream.

IntegerStream

IntStream

1 points   

QUESTION 19

The basic generic functional interface ________ in package java.util.function contains method get that takes no arguments and produces a value of type T. Often used to create a collection object in which a stream operation’s results are placed.

Consumer<T>

Function<T,R>

Supplier<T>

BinaryOperator<T>

1 points   

QUESTION 20

The basic generic functional interface ________ in package java.util.function contains method accept that takes a T argument and returns void. Performs a task with its T argument, such as outputting the object, invoking a method of the object, etc.

Consumer<T>

Function<T,R>

Supplier<T>

BinaryOperator<T>

1 points   

QUESTION 21

The basic generic functional interface ________ in package java.util.function contains method apply that takes two T arguments, performs an operation on them (such as a calculation) and returns a value of type T.

Consumer<T>

Function<T,R>

Supplier<T>

BinaryOperator<T>

1 points   

QUESTION 22

By default, method sorted uses ________.

ascending order

the natural order for the stream's element type

descending order

the order specified in a command-line argument

1 points   

QUESTION 23

Map method entrySet returns a Set of Map.Entry objects containing the Map’s ________.

values

keys

index

key–value pairs

1 points   

Consumer<T>

Function<T,R>

Supplier<T>

Predicate<T>

Explanation / Answer

Note Explaination or answer for these questions given by read java docs. The basic generic functional interface ________ in package java.util.function contains method test that takes a T argument and returns a boolean. Tests whether the T argument satisfies a condition. Answer : Predicate Represents a predicate (boolean-valued function) of one argument. QUESTION 14 Stream method ________ maps objects to double values and returns a DoubleStream. The method receives an object that implements the functional interface ToDoubleFunction (package java.util.function). Answer: toDoubleStream QUESTION 15 Collectors static method groupingBy with one argument receives a Function that classifies objects in the stream—the values returned by this function are used as the keys in a Map. The corresponding values, by default, are ________ containing the stream elements in a given category. Collector A mutable reduction operation that accumulates input elements into a mutable result container, optionally transforming the accumulated result into a final representation after all input elements have been processed. QUESTION 16 Functional interface BiConsumer’s accept method has two parameters. For Maps, the first represents the ________ and the second the corresponding ________. Answer : lambda, value QUESTION 17 Class Array’s ________ method is used to create a Stream from an array of objects. Answer : Stream A sequence of elements supporting sequential and parallel aggregate operations. QUESTION 18 An ________ (package java.util.stream) is a specialized stream for manipulating int values. Answer : IntStream A sequence of primitive int-valued elements supporting sequential and parallel aggregate operations. QUESTION 19 The basic generic functional interface ________ in package java.util.function contains method get that takes no arguments and produces a value of type T. Often used to create a collection object in which a stream operation’s results are placed. Answer : Supplier Represents a supplier of results. QUESTION 20 The basic generic functional interface ________ in package java.util.function contains method accept that takes a T argument and returns void. Performs a task with its T argument, such as outputting the object, invoking a method of the object, etc. Answer : Consumer Represents an operation that accepts a single input argument and returns no result. QUESTION 21 The basic generic functional interface ________ in package java.util.function contains method apply that takes two T arguments, performs an operation on them (such as a calculation) and returns a value of type T. Answer : BinaryOperator Represents an operation upon two operands of the same type, producing a result of the same type as the operands. QUESTION 22 By default, method sorted uses ________. Answer : assending QUESTION 23 Map method entrySet returns a Set of Map.Entry objects containing the Map’s ________. Answer : key–value pairs The Map.entrySet method returns a collection-view of the map, whose elements are of this class.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote