Java LinkedBlockingDeque getFirst() methodThe getFirst() method of LinkedBlockingDeque class returns the first element of this deque but does not withdraw it. Syntax:Parameters:NA Specified By:The getFirst() method of LinkedBlockingDeque class is specified by getFirst() method in interface Deque<E>. Return Value:The getFirst() method returns the first element of this deque. Throws:The getFirst() method throws NoSuchElementException, if this deque is empty. Example 1Test it NowOutput: First element in the Queue is : 987 Example 2Test it NowOutput: Exception in thread "main" java.util.NoSuchElementException at java.util.concurrent.LinkedBlockingDeque.getFirst(Unknown Source) Example 3Test it NowOutput: Mansi got 41 bonus_points. Vaibhav got 33 bonus_points. Shraddha got 31 bonus_points. Vishal got 27 bonus_points. Shalu got 26 bonus_points. Abhi got 19 bonus_points. On the basis of bonus points, Promotion is awarded to : Mansi Next TopicJava Linkedblockingdeque |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India