The new language and library capabilities that support functional programming we
ID: 3731682 • Letter: T
Question
The new language and library capabilities that support functional programming were added to Java as part of Project ________.
Utilitarian
Upsilon
Lambda
Utility
1 points
QUESTION 25
Functional interface Comparator’s default method ________ reverses an existing Comparator’s ordering.
invert
descending
reversed
downward
1 points
QUESTION 26
Map method ________ performs an operation on each key–value pair.
for
forNext
forEach
forAll
1 points
QUESTION 27
Stream mutable reduction operation ________ creates a new collection of elements containing the results of the stream’s prior operations.
combine
accumulate
gather
collect
1 points
QUESTION 28
________ is a method reference for an instance method that should be called on a specific object. It creates a one-parameter lambda that invokes the instance method on the specified object—passing the lambda’s argument to the instance method—and returns the method’s result.
Math::sqrt
System.out::println
TreeMap::new
String::toUpperCase
1 points
QUESTION 29
Stream method ________ eliminates duplicate objects in a stream.
distinct
discrete
unique
different
1 points
QUESTION 30
Intermediate Stream operation ________ results in a stream in which each element of the original stream is mapped to a new value (possibly of a different type)—e.g., mapping numeric values to the squares of the numeric values. The new stream has the same number of elements as the original stream.
mapped
map
mapper
mapping
1 points
QUESTION 31
Collectors static method ________ returns a Collector that counts the number of objects in a given classification, rather than collecting them into a List.
counter
count
counting
enumerate
1 points
QUESTION 32
Stream mutable reduction operation ________creates an array containing the results of the stream’s prior operations.
array
createArray
toArray
reduceArray
Utilitarian
Upsilon
Lambda
Utility
Explanation / Answer
24.ans)Lambda
The new language and library capabilities that support functional programming were added to Java as part of Project lambda because it supports programming in a multicore environment by adding closures and related features to the Java language.
25.ans)descending
Functional interface Comparator’s default method descending reverses an existing Comparator’s ordering.
26.ans) forEach
Map method forEach performs an operation on each key–value pair.
27.ans) accumulate
Stream mutable reduction operation accumulate creates a new collection of elements containing the results of the stream’s prior operations because 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.
28.ans) System.out::println
In a method reference, you place the object (or class) that contains the method before the :: operator and the name of the method after it without arguments.
29.ans) distinct
Stream method distinct eliminates duplicate objects in a stream.
30.ans) map
because Stream map() method is useful to map or transform an input collection into a new output collection.
31.ans)count
because it returns a Collector accepting elements of type T that counts the number of input elements.
32.ans)toArray
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.