Java Doc for PriorityQueue.java in  » Apache-Harmony-Java-SE » java-package » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.util.PriorityQueue

PriorityQueue
public class PriorityQueue extends AbstractQueue implements Serializable(Code)
PriorityQueue holds elements on a priority heap, which orders elements according to the comparator specified at construction or their natural order. If the queue uses natural order, any element that is not comparable is not permitted to insert to the queue. The least element of the specified ordering is stored at the head of the queue and the greatest element is stored at the tail of the queue. PriorityQueue is not synchronized. If multiple threads will access it concurrently, use the PriorityBlockingQueue.



Constructor Summary
public  PriorityQueue()
     Constructs a priority queue with the capacity of 11 and natural ordering.
public  PriorityQueue(int initialCapacity)
     Constructs a priority queue with specified capacity and natural ordering.
public  PriorityQueue(int initialCapacity, Comparator<? super E> comparator)
     Constructs a priority queue with specified capacity and comparator.
Parameters:
  initialCapacity - the specified capacity.
Parameters:
  comparator - the specified comparator.
public  PriorityQueue(Collection<? extends E> c)
     Constructs a priority queue that contains the elements of a collection. The constructed priority queue has the initial capacity of 110% the collection.
public  PriorityQueue(PriorityQueue<? extends E> c)
     Constructs a priority queue that contains the elements of another priority queue.
public  PriorityQueue(SortedSet<? extends E> c)
     Constructs a priority queue that contains the elements of a sorted set. The constructed priority queue has the initial capacity of 110% the sorted set.

Method Summary
public  booleanadd(E o)
     Adds the specified object to the priority queue.
Parameters:
  o - the object to be added.
public  voidclear()
     Removes all the elements of the priority queue.
public  Comparator<? super E>comparator()
     Gets the comparator of the priority queue. the comparator of the priority queue.
public  Iterator<E>iterator()
     Gets the iterator of the priority queue, which will not return elements in any specified ordering.
public  booleanoffer(E o)
     Inserts the element to the priority queue.
public  Epeek()
     Gets but not removes the head of the queue. the head of the queue.
public  Epoll()
     Gets and removes the head of the queue. the head of the queue.
public  booleanremove(Object o)
     Removes the specified object of the priority queue.
Parameters:
  o - the object to be removed.
public  intsize()
     Gets the size of the priority queue.


Constructor Detail
PriorityQueue
public PriorityQueue()(Code)
Constructs a priority queue with the capacity of 11 and natural ordering.



PriorityQueue
public PriorityQueue(int initialCapacity)(Code)
Constructs a priority queue with specified capacity and natural ordering.
Parameters:
  initialCapacity - the specified capacity.
throws:
  IllegalArgumentException - if the initialCapacity is less than 1



PriorityQueue
public PriorityQueue(int initialCapacity, Comparator<? super E> comparator)(Code)
Constructs a priority queue with specified capacity and comparator.
Parameters:
  initialCapacity - the specified capacity.
Parameters:
  comparator - the specified comparator. If it is null, the naturalordering will be used.
throws:
  IllegalArgumentException - if the initialCapacity is less than 1



PriorityQueue
public PriorityQueue(Collection<? extends E> c)(Code)
Constructs a priority queue that contains the elements of a collection. The constructed priority queue has the initial capacity of 110% the collection. And the priority queue uses natural ordering to order its elements.
Parameters:
  c - the collection whose elements will be added to the priorityqueue to be constructed.
throws:
  ClassCastException - if any of the elements in the collection isnot comparable.
throws:
  NullPointerExcepiton - if any of the elements in the collection isnull.



PriorityQueue
public PriorityQueue(PriorityQueue<? extends E> c)(Code)
Constructs a priority queue that contains the elements of another priority queue. The constructed priority queue has the initial capacity of 110% the latter one. And the two priority queue has the same comparator.
Parameters:
  c - the priority queue whose elements will be added to the priorityqueue to be constructed.



PriorityQueue
public PriorityQueue(SortedSet<? extends E> c)(Code)
Constructs a priority queue that contains the elements of a sorted set. The constructed priority queue has the initial capacity of 110% the sorted set. And the priority queue has the same comparator of the sorted set.
Parameters:
  c - the sorted set whose elements will be added to the priorityqueue to be constructed.




Method Detail
add
public boolean add(E o)(Code)
Adds the specified object to the priority queue.
Parameters:
  o - the object to be added. true.
throws:
  ClassCastException - if the element cannot be compared with theelements in the priority queue using the ordering of the priorityqueue.
throws:
  NullPointerExcepiton - if the element is null.



clear
public void clear()(Code)
Removes all the elements of the priority queue.



comparator
public Comparator<? super E> comparator()(Code)
Gets the comparator of the priority queue. the comparator of the priority queue. Null if the naturalordering is used.



iterator
public Iterator<E> iterator()(Code)
Gets the iterator of the priority queue, which will not return elements in any specified ordering. the iterator of the priority queue.



offer
public boolean offer(E o)(Code)
Inserts the element to the priority queue. true
throws:
  ClassCastException - if the element cannot be compared with theelements in the priority queue using the ordering of the priorityqueue.
throws:
  NullPointerExcepiton - if the element is null.



peek
public E peek()(Code)
Gets but not removes the head of the queue. the head of the queue. Null if the queue is empty.



poll
public E poll()(Code)
Gets and removes the head of the queue. the head of the queue. Null if the queue is empty.



remove
public boolean remove(Object o)(Code)
Removes the specified object of the priority queue.
Parameters:
  o - the object to be removed. true if the object is in the priority queue, false if the objectis not in the priority queue.



size
public int size()(Code)
Gets the size of the priority queue. If the size of the queue is greater than the Integer.MAX, then it returns Integer.MAX. the size of the priority queue.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.