Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-809 Topic 16 Question 61 Discussion

Actual exam question for Oracle's 1Z0-809 exam
Question #: 61
Topic #: 16
[All 1Z0-809 Questions]

Given:

IntStream stream = IntStream.of (1,2,3);

IntFunction inFu= x -> y -> x*y;//line n1

IntStream newStream = stream.map(inFu.apply(10));//line n2

newStream.forEach(System.out::print);

Which modification enables the code fragment to compile?

Show Suggested Answer Hide Answer
Suggested Answer: D


Contribute your Thoughts:

Jame
1 months ago
D is the way to go. Gotta love those functional interfaces and their specific method names. Makes total sense to use applyAsInt() here.
upvoted 0 times
...
Rusty
1 months ago
Haha, C is definitely not the right answer. A BiFunction with an IntUnaryOperator? That doesn't even make sense!
upvoted 0 times
...
Mabelle
1 months ago
I think B is the right answer. The IntFunction needs to take an IntUnaryOperator, which is a functional interface that takes an int and returns an int.
upvoted 0 times
Launa
1 days ago
B) Replace line n1 with:IntFunction inFu = x -> y -> x*y;
upvoted 0 times
...
Donette
3 days ago
A) Replace line n1 with:IntFunction inFu = x -> y -> x*y;
upvoted 0 times
...
...
Xuan
2 months ago
The correct answer is D. We need to use the applyAsInt() method since the IntFunction is expecting an Integer parameter, not a UnaryOperator or IntUnaryOperator.
upvoted 0 times
Shaquana
15 days ago
The correct answer is D. We need to use the applyAsInt() method since the IntFunction is expecting an Integer parameter, not a UnaryOperator or IntUnaryOperator.
upvoted 0 times
...
Ivette
18 days ago
C) Replace line n1 with:BiFunction inFu = x -> y -> x*y;
upvoted 0 times
...
Margret
21 days ago
B) Replace line n1 with:IntFunction inFu = x -> y -> x*y;
upvoted 0 times
...
Arthur
1 months ago
A) Replace line n1 with:IntFunction inFu = x -> y -> x*y;
upvoted 0 times
...
...
Remedios
2 months ago
I'm not sure, but I think the rationale for B is that IntUnaryOperator is the correct functional interface for the lambda expression used in the code.
upvoted 0 times
...
Nydia
3 months ago
I disagree, I believe the correct answer is A.
upvoted 0 times
...
Keith
3 months ago
I think the correct answer is B.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77