Last active
August 18, 2016 17:14
-
-
Save geniushkg/6cb904e9d4270e76e411952f383ca8fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class QueueSample{ | |
public static void main(String args[]){ | |
Queue<Character> queVar = new LinkList<Character>(); | |
System.out.println("Adding new character to queue."); | |
queVar.add('A'); | |
que.Var.add('B'); | |
// peek() is used to give first element , will not remove from queue | |
System.out.println(queVar.peek() + " is First element in que."); | |
// A is First element in que. | |
// poll() is used to give first element and removes it from queue | |
System.out.println(queVar.poll() + "is First element in que." ); | |
// A is First element in que. | |
System.out.println(queVar.poll() + "is First element in que."); | |
// B is First element in que. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment