Answer the following statements true (T) or false (F)
1) Lambda expressions can be used anywhere functional interfaces are expected.
2) Terminal operations are lazy—they perform the requested operation when they are
called.
3) Method reduce’s first argument is formally called an identity value—a value that, when combined with a stream element using the IntBinaryOperator, produces the stream el ement’s original value. For example, when summing the elements, the identity value is 1, and when getting the product of the elements, the identity value is 0.
4) Stream method findFirst is a short-circuiting terminal operation that processes the stream pipeline but terminates processing as soon as an object is found.
5) Stream method flatMap receives a Function that maps a stream into an object. For ex- ample, the object could be a String containing words and the result could be another intermediate Stream
6) When a class implements an interface with default methods and overrides them, the class inherits the default methods’ implementations. An interface’s designer can now evolve an interface by adding new default and static methods without breaking ex- isting code that implements the interface.
1) True.
2) False. Terminal operations are eager—they perform the requested operation when they are called.
3) False. When summing the elements, the identity value is 0, and when getting the product of the elements, the identity value is 1.
4) True.
5) False. Stream method flatMap receives a Function that maps an object into a stream.
6) False. Should say: “…does not override them, …” instead of “overrides them.”
You might also like to view...
A field is a group of related records that can be identified by the user with a name, type, and size.
Answer the following statement true (T) or false (F)
What type of DNS resource record associates a particular TCP/IP service to a server along with the domain of the server and its protocol?
A. NS B. SRV C. SOA D. CNAME