java me - Peek() and remove() methods for Queue implementation in Blackberry -


I get QQ of Java and Qi. Like the Rev (), I want to apply and remove the pickup application in Blackberry. I have a custom queue implementation, but how do I get to peek at the elements and remove the elements from the queue?

Please help,

Thanks in advance.

Try to use the class ... if you want to peek, remove the last one For, take the last element from the object array: / P>

  class queue {private object [] amelments = new object [] {}; Public Zero Enqueue (Arrays.insertAt (Milements, Element, 0); } Public object dequeue () {object result = zero; If (empty! = Amelments & amp; amp; amp; 0; elements.lamp) {result = amelements [amelments. Length - 1]; Arrays.remove (meillements, results); } Return results; } Public Object Peek () (If (Zero! = Mealments & amp; MTELMant.Lamp) Measures [Milements, Long-1]; And Faucet Return;} Public Zero Extract () (If (Zero! = Milements & amp; ; Amp; amp; amp; amp; mlx lamps) Arrays.remove (amelments, peak ());}}  

using the example:

  Square Scr increases MainScreen {public Scr ()) {queue que = new queue (); queue.NQ (new string ("3")); Q.Anquayu (new boolean (true)); See "3" System.out.println (queue.peek ()) // in RNQ (New Integer (1)); // View "3" still there system.out.println (queue.peek ()); // Remove "3" Q. Remove () Remove the "true" in the console; system.out.println (queue.peek ()); // all elements object element = null; while ((element Click on = queue.dequeue ())! = Null {System.out.println (element.toString ());}}}  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -