Sei sulla pagina 1di 2

Queue data structure : Queue « Collections Data Structure « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced
Graphics
4. Ant
Java » Collections Data Structure » Queue Screenshots Search
5. Apache Common
6. Chart
Queue data structure
7. Class
8. Collections Data
Structure
9. Data Type
10. Database SQL
JDBC
11. Design Pattern public class Queue {
12. Development private int maxSize;
Class
13. EJB3 private long[] queArray;
14. Email
private int front;
15. Event
16. File Input Output private int rear;
17. Game
private int nItems;
18. Generics
19. GWT public Queue(int s) {
20. Hibernate maxSize = s;
21. I18N queArray = new long[maxSize];
front = 0;
22. J2EE
rear = -1;
23. J2ME nItems = 0;
24. JDK 6 }
25. JNDI LDAP
// put item at end of a queue
26. JPA
public void insert(long j) {
27. JSP if (rear == maxSize - 1) // deal with wraparound
28. JSTL rear = -1;
29. Language Basics queArray[++rear] = j; // increment rear and insert
nItems++;
30. Network Protocol
}
31. PDF RTF
32. Reflection // take item from front of queue
33. Regular public long remove() {
Expressions long temp = queArray[front++]; // get value and incr front
if (front == maxSize) // deal with wraparound
34. Scripting
front = 0;
35. Security nItems--; // one less item
36. Servlets return temp;
37. Spring }
38. Swing
public long peekFront() {
Components
return queArray[front];
39. Swing JFC }
40. SWT JFace
Eclipse public boolean isEmpty() {
41. Threads return (nItems == 0);
}
42. Tiny Application
43. Velocity public boolean isFull() {
44. Web Services return (nItems == maxSize);
SOA }
45. XML
public int size() {
Java Tutorial
return nItems;
Java Source Code / }
Java Documentation
Java Open Source public static void main(String[] args) {
Jar File Download Queue theQueue = new Queue(5); // queue holds 5 items
Java Articles
Java Products theQueue.insert(10);
Java by API theQueue.insert(20);
Photoshop Tutorials theQueue.insert(30);
Maya Tutorials theQueue.insert(40);
Flash Tutorials
3ds-Max Tutorials theQueue.remove();
Illustrator Tutorials theQueue.remove();
GIMP Tutorials theQueue.remove();
C# / C Sharp
theQueue.insert(50);
C# / CSharp Tutorial
theQueue.insert(60); // (wraps around)
C# / CSharp Open
theQueue.insert(70);
Source
theQueue.insert(80);
ASP.Net
ASP.NET Tutorial while (!theQueue.isEmpty()) {
JavaScript DHTML long n = theQueue.remove(); // (40, 50, 60, 70, 80)
JavaScript Tutorial System.out.print(n); Generated by www.PDFonFly.com at 9/17/2010 2:47:30 AM
JavaScript Reference System.out.print(" "); URL: http://www.java2s.com/Code/Java/Collections-Data-Structure/Queuedatastructure.htm
HTML / CSS }
HTML CSS System.out.println("");
Reference }
C / ANSI-C }
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source Related examples in the same category
SQL Server / T-SQL
SQL Server / T-SQL 1. Priority queue
Tutorial
Oracle PL / SQL 2. Convert a Queue to a List
Oracle PL/SQL
Tutorial
PostgreSQL 3. Create a queue using LinkedList class
SQL / MySQL
MySQL Tutorial 4. Simple Queue (FIFO) based on LinkedList
VB.Net
VB.Net Tutorial
5. The Generic Queue Class
Flash / Flex /
ActionScript
VBA / Excel / Access / 6. Blocking Queue
Word
XML 7. Circular Queue
XML Tutorial
Microsoft Office
PowerPoint 2007 8. Circular Queue extends AbstractList
Tutorial
Microsoft Office Excel
2007 Tutorial
Microsoft Office Word
2007 Tutorial
www___.___j_a__v_a2_s___.co_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.

Generated by www.PDFonFly.com at 9/17/2010 2:47:31 AM


URL: http://www.java2s.com/Code/Java/Collections-Data-Structure/Queuedatastructure.htm

Potrebbero piacerti anche