Salve javarianos,
alguem tem algum exemplo ou pode dar uma ajudo na utilização da classe java.util.concurrent.PriorityBlockingQueue ?
valeus
Luiz
Salve javarianos,
alguem tem algum exemplo ou pode dar uma ajudo na utilização da classe java.util.concurrent.PriorityBlockingQueue ?
valeus
Luiz
Ainda bem que não disse “javiados” - era isso que um colega meu de .NET ficava dizendo, só para provocar a gente…
De qualquer maneira, nada que o Google não ache para a gente:
http://www-106.ibm.com/developerworks/java/library/j-tiger06164.html
PriorityBlockingQueue is a queue with an unbound capacity that maintains elements in their logical order through use of the Comparable sort order of the contained elements. Think of it as a possible replacement for TreeSet. For instance, adding the strings One, Two, Three, and Four to the queue will result in Four being the first one taken out. For elements without a natural order, you can provide a Comparator to the constructor. There is one trick with PriorityBlockingQueue, though. The Iterator instance returned from iterator() doesn’t necessarily return the elements in priority order. If you must get all the elements in priority order for traversal, get them all through the toArray() method and sort them yourself, like Arrays.sort(pq.toArray())
Salve Thingol
valeu pelo link do javalobby, não tinha visto ele entra as respostas do magavilhoso google. Mas mesmo assim ainda não sei como utilizar, a idéia da classe é legal, aparenta facilitar uma ou outra coisa, só não sei pq o maledito cliente quer tanto que eu a utiliza eheheh…
valeu
Luiz