About Question enthuware.ocpjp.ii.v11.2.3322 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
dfigueira
Posts: 21
Joined: Thu May 05, 2016 2:50 am
Contact:

About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by dfigueira »

Couldn't this option be accepted as well?

Code: Select all

.collect(Collectors.filtering(p, Collectors.mapping(Book::getTitle, Collectors.toSet()));

It returns the same result as the options marked as correct.

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

Yes, this is option 5 and it is marked as correct already.
If you like our products and services, please help us by posting your review here.

teodorj
Posts: 33
Joined: Tue Jun 19, 2018 10:27 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by teodorj »

for the third option to be correct
.collect(Collectors.partitioningBy(p, Collectors.mapping(Book::getTitle, Collectors.toSet())));
the return type should be Map<Boolean, Set<String>> newBooks

But the option
.collect(Collectors.filtering(p, Collectors.mapping(Book::getTitle, Collectors.toSet()));
is incorrect in my side. Please see below.
Image

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

Which version of which question bank are you using?
If you like our products and services, please help us by posting your review here.

teodorj
Posts: 33
Joined: Tue Jun 19, 2018 10:27 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by teodorj »

This is for IZ0-817 exam

Ihave the latest ets viewer

Image
Image
Image

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

ok, I see that it is not updated in 817 question bank. Sorry about that. Updated now in v 1.20
If you like our products and services, please help us by posting your review here.

teodorj
Posts: 33
Joined: Tue Jun 19, 2018 10:27 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by teodorj »

my ets viewer did not see update on question bank
Image

teodorj
Posts: 33
Joined: Tue Jun 19, 2018 10:27 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by teodorj »

And also, some of the question in ETS does not have "*" in Discuss button when there are discussion in this forum

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

Yes, the matching algorithm for questions in the s/w with the subject in topics of the forum is not accurate because of same question appearing in different versions of the exam. It errs on the side of caution.
If you like our products and services, please help us by posting your review here.

edufin166@yahoo.com
Posts: 24
Joined: Wed Sep 28, 2022 9:41 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by edufin166@yahoo.com »

Theis alternative "is .collect(Collectors.filtering(p,      Collectors.mapping(Book::getTitle, Collectors.toSet())));"

should return Map<String,Set<String>>, but seems me that is returning Set<String>.

Is it really correct?

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

The call to Collectors.mapping(Book::getTitle, Collectors.toSet()) converts a stream of Books into a Set of title string. This call is wrapped inside Collectors.filtering(p,...), which filters the Set of titles based on the given Predicate. So it returns a Set.
Why do you think it should return a Map?

You may also want to try compiling and running the given code.
If you like our products and services, please help us by posting your review here.

pavvel
Posts: 12
Joined: Fri Dec 15, 2023 4:00 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by pavvel »

Code: Select all

Collectors.toCollection(TreeSet::new)
The first case should not work because toCollection accept Supplier. Comperr expected.

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

pavvel wrote:
Mon Apr 29, 2024 10:01 am

Code: Select all

Collectors.toCollection(TreeSet::new)
The first case should not work because toCollection accept Supplier. Comperr expected.
Yes and TreeSet::new is a valid method reference that implements Supplier.
If you like our products and services, please help us by posting your review here.

_umut_
Posts: 6
Joined: Sun Sep 15, 2024 12:42 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by _umut_ »

I noticed a small discrepancy in the wording of this question that might be worth clarifying. The question asks for 'a set of books', but the code structure (Set<String>) suggests we're actually collecting book titles. Would it be more precise to say 'a set of book titles' in the question text, to distinguish it from book objects? This minor adjustment could help align the wording more closely with the expected code implementation.

admin
Site Admin
Posts: 10209
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3322 :

Post by admin »

Good point. Will update.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 35 guests