Page 1 of 1

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

Posted: Thu Nov 26, 2020 6:37 pm
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.

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

Posted: Thu Nov 26, 2020 10:22 pm
by admin
Yes, this is option 5 and it is marked as correct already.

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

Posted: Thu Jan 07, 2021 2:36 am
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

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

Posted: Thu Jan 07, 2021 3:04 am
by admin
Which version of which question bank are you using?

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

Posted: Thu Jan 07, 2021 3:28 am
by teodorj
This is for IZ0-817 exam

Ihave the latest ets viewer

Image
Image
Image

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

Posted: Thu Jan 07, 2021 4:09 am
by admin
ok, I see that it is not updated in 817 question bank. Sorry about that. Updated now in v 1.20

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

Posted: Thu Jan 07, 2021 4:22 am
by teodorj
my ets viewer did not see update on question bank
Image

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

Posted: Thu Jan 07, 2021 4:51 am
by teodorj
And also, some of the question in ETS does not have "*" in Discuss button when there are discussion in this forum

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

Posted: Thu Jan 07, 2021 5:02 am
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.

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

Posted: Fri Jun 16, 2023 12:40 pm
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?

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

Posted: Fri Jun 16, 2023 11:43 pm
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.

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

Posted: Mon Apr 29, 2024 10:01 am
by pavvel

Code: Select all

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

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

Posted: Mon Apr 29, 2024 11:14 am
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.

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

Posted: Wed Oct 02, 2024 2:57 am
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.

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

Posted: Wed Oct 02, 2024 3:43 am
by admin
Good point. Will update.
thank you for your feedback!