About Question enthuware.ocpjp.v17.2.3729 :

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

Moderator: admin

Post Reply
Tester
Posts: 34
Joined: Mon Oct 30, 2023 11:55 am
Contact:

About Question enthuware.ocpjp.v17.2.3729 :

Post by Tester »

1. spliterator() is a default method in Collection, so all Collections have it.
Does Map have it?

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

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by admin »

Is Map a Collection (with uppercase C)?
If you like our products and services, please help us by posting your review here.

Tester
Posts: 34
Joined: Mon Oct 30, 2023 11:55 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by Tester »

admin wrote:
Sat Nov 04, 2023 7:55 pm
Is Map a Collection (with uppercase C)?
Sorry, I asked you a question and got a new question. Could you please correct mistake if it is?

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

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by admin »

As the quoted statement says, the spliterator() method is defined in the Collection interface. Map is not a Collection because it does not extend Collection interface.

If you are ever in doubt about whether a class has a method, just refer the JavaDoc API documentation. For example: https://docs.oracle.com/en/java/javase/ ... l/Map.html
If you like our products and services, please help us by posting your review here.

Tester
Posts: 34
Joined: Mon Oct 30, 2023 11:55 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by Tester »

Depend on English description
https://www.collinsdictionary.com/dicti ... collection

its collection. Depend on your own description what does it mean Java collection, its not.
Could you please add what does it mean a collection in Java/Oracle World?
Personally for me Map is a collection because it group similar objects.

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

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by admin »

That is why I wrote Collection with a captial/uppercase C. When you say something is a Collection, it has a precise meaning in Java. It means that that something implements Collection interface. Map does not. My or your personal view does not matter.
If you like our products and services, please help us by posting your review here.

Tester
Posts: 34
Joined: Mon Oct 30, 2023 11:55 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by Tester »

FYI:
https://docs.oracle.com/javase/8/docs/a ... ction.html
A collection represents a group of objects, known as its elements.
but on the other hand it tells
The root interface in the collection hierarchy.
With "c" in "Collection"
if we take a look here:
https://docs.oracle.com/javase/tutorial ... index.html
A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit.
and by the way, they use "C" in "Introduction to Collections". Why do they use "C" its not an Interface and not a beginning of sentence. Maybe they would like to show some idea? What about your case, what do you mean, Interface, some other idea? Who knows?
Maybe its a good idea to add some clarification for people who learn?

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

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by admin »

Since this discussion is linked to the question, other readers can also see it.

Even from the JavaDoc page for Collection that you quoted, "The root interface in the collection hierarchy.", Map is not a Collection because Map is not under that root interface.

So, as far as the explanation to this question is concerned, it is clear as well as correct.
If you like our products and services, please help us by posting your review here.

Tester
Posts: 34
Joined: Mon Oct 30, 2023 11:55 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by Tester »

I have found interesting question "Foundation Test 3 -> Q10":
Which is/are the root interface(s) for all collection related interfaces?

and the right answers:
Collection
Map

Could you please comment?

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

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by admin »

It says "all collection related" but it would be better to write "collection framework related" or "collection API related".
Map is indeed part of the "collection framework".
If you like our products and services, please help us by posting your review here.

steinov
Posts: 19
Joined: Wed Feb 08, 2023 3:11 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by steinov »

Which methods in the Spliterator interface should I know for the exam? The book I'm using (Sybex OCP 17 Study Guide) only mentions trySplit() forEachRemaining() and tryAdvance(). But this question also mentions estimateSize().

Btw, I think there is a small error in the explanation.
Therefore, the estimateSize() method will return an estimate but an exact number.
Should be
Therefore, the estimateSize() method will not return an estimate but an exact number.
Right?

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

Re: About Question enthuware.ocpjp.v17.2.3729 :

Post by admin »

1. Having a brief idea about trySplit, tryAdvance, forEachRemaining and estimateSize would be good enough for the exam.
2. Right. Fixed.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 261 guests