Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 26 - Answers page #67

Closed
mabiosb opened this issue May 6, 2018 · 2 comments
Closed

Chapter 26 - Answers page #67

mabiosb opened this issue May 6, 2018 · 2 comments

Comments

@mabiosb
Copy link

mabiosb commented May 6, 2018

I believe that the alternative of the letter 'A' is also correct.

  1. Given:
ExecutorService service = Executors.newFixedThreadPool(2);
Future result = service.submit(() -> 1);

Assuming it compiles correctly, what is the type of the lambda expression?
A. Runnable
B. Callable
C. Supplier
D. Function

eh3rrera added a commit that referenced this issue May 7, 2018
@eh3rrera
Copy link
Owner

eh3rrera commented May 7, 2018

Well, while submit also takes a Runnable, the lambda expression in the question returns a value (1), so it has to be a Callable, which can return a value.

However, this question may be unnecessarily confusing, so I changed Runnable to Predicate.

Thanks!

@mabiosb
Copy link
Author

mabiosb commented May 7, 2018

Got it! Thanks for the explanation.

@mabiosb mabiosb closed this as completed May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants