Java Reference
In-Depth Information
yet easy to use way. One last point: although the streams supported by the new
stream API have some similarities with the I/O streams described in
Chapter 10
, they
are not the same.
The program produces the following output:
Chapter 14 Self Test
ive.
question 5. Call the interface
MyTest
and its abstract method
testing( )
.
use. Use
NumericFunc
, shown in this chapter, for the functional interface.
func( )
. Have
func( )
return a reference of type
T
. Have it take a parameter of type
T
.
(Thus,
MyFunc
will be a generic version of
NumericFunc
shown in the chapter.)
Demonstrate its use by rewriting your answer to question 7 so it uses
MyFunc<T>
rather than
NumericFunc
.
9
.
Using the program shown in
Try This 14-1
, create a lambda expression that removes
all spaces from a string and returns the result. Demonstrate this method by passing it
to
changeStr( )
.