Page 1 of 1

About Question enthuware.ocpjp.v7.2.1594 :

Posted: Tue Jun 25, 2013 4:53 pm
by emj211
Each time I see the word 'ordered' I immediately think 'sorted' which I know is wrong. Here it means maintaining insertion order.

Can it be assumed that any mention of 'ordered' when referring to collections always means 'insertion order' and not 'sorted order'?

Thanks.

Re: About Question enthuware.ocpjp.v7.2.1594 :

Posted: Tue Jun 25, 2013 5:54 pm
by admin
Yes, order always means insertion order in Java collections terminology unless explicitly stated otherwise.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1594 :

Posted: Wed Nov 22, 2017 8:37 am
by phusztek
Related to this question:
ordered means you need a class that implements List
The ordered only means List implementation? It cannot be a queue?

Thanks!

Re: About Question enthuware.ocpjp.v7.2.1594 :

Posted: Wed Nov 22, 2017 8:48 am
by admin
A Queue does keep the elements in order but that order is not necessarily the order in which the elements are inserted in the queue (as is required in the question). For example, a PriorityQueue may keep elements in order of the priority of the elements.