Hello! The PriorityQueue class iterator() returns elements in no particular order. This is explicitly stated in JavaDoc for iterator() method [1] as well as in class description [2]. However it's not mentioned mentioned that spliterator() method also traverses the queue in no particular order. Well, the user might guess that the order is not specified, because the spliterator does not have ORDERED characteristic, but it's not so obvious for any user. Probably it's would be good to add an explicit note like it's done for iterator. The same thing is for PriorityBlockingQueue. What do you think?
With best regards, Tagir Valeev. [1] http://hg.openjdk.java.net/jdk9/dev/jdk/file/022d45d94d0a/src/java.base/share/classes/java/util/PriorityQueue.java#l477 [2] http://hg.openjdk.java.net/jdk9/dev/jdk/file/022d45d94d0a/src/java.base/share/classes/java/util/PriorityQueue.java#l54