I need an example on queue implementation in java
jds_14
0
Newbie Poster
Recommended Answers
Jump to PostYou can use LinkedList or Stack:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedList.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Stack.htmlLinkedList<String> fifo = new LinkedList<String>(); fifo.add("First"); fifo.add("Second"); fifo.add("Last"); System.out.println(fifo.poll()); System.out.println(fifo.poll()); System.out.println(fifo.poll()); Stack<String> lifo = new Stack<String>(); lifo.add("First"); lifo.add("Second"); lifo.add("Last"); System.out.println(lifo.pop()); System.out.println(lifo.pop()); …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.