About Question enthuware.ocpjp.v8.2.1585 :

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

Moderator: admin

Post Reply
karlharb
Posts: 2
Joined: Wed Apr 06, 2016 12:54 pm
Contact:

About Question enthuware.ocpjp.v8.2.1585 :

Post by karlharb »

One of the answers to this question is:
The order of elements while iteration remains the same always.
This statement does not make sense, as far as I can see?

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

Re: About Question enthuware.ocpjp.v8.2.1585 :

Post by admin »

It means that when you iterate through the elements in a HashSet, you get the elements in the same order no matter how many times you iterate. For example, if you iterate through a HashSet and if you get A, B, C first time, then if you iterate again, you will still get A, B, C. You will not get A, C, B.

This is of course incorrect (as given in the explanation) because HashSet does not guarantee this behavior.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Touciuciu
Posts: 11
Joined: Fri Aug 17, 2018 8:52 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1585 :

Post by Touciuciu »

This explanation for this question is incorrect (second choice) or confussing:

No Set (HashSet, TreeSet, or any other implementation of Set interface) allows duplicate elements.

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

Re: About Question enthuware.ocpjp.v8.2.1585 :

Post by admin »

Why do you think it is incorrect?
If you like our products and services, please help us by posting your review here.

Touciuciu
Posts: 11
Joined: Fri Aug 17, 2018 8:52 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1585 :

Post by Touciuciu »

What I understand from this answear is that Set allows duplicate elements which is incorrect.

I think the correct form should be:
Set (HashSet, TreeSet, or any other implementation of Set interface) does not allow duplicate elements.

It is kind of the same but more concrete and not at all confussing

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests