Java Deque

Java Deque is an interface extends Queue interface and both belongs to java.util package.

Deque is also called as ‘double ended queue’ which allows us to insert and delete element from both the sides.

A deque can be used as a stack, which is last in first out, or a queue, which is first in first out.

Add and Remove HashMap item:

Below is the example for some of the methods which allow us to add and remove HashMap items.

Note: I always try to make things easy and simple, please read comments while reading code snippet will help to understand better. 

OUTPUT:

Peek, poll and element HashMap item

Below is the example for some of the methods which allow us to add, peek, poll, element, peakFirst and peakLast HashMap items.

Note: I always try to make things easy and simple, please read comments while reading code snippet will help to understand better.

OUTPUT:

Some more HashMap methods

Below is the example for some of the methods which allow us to check for contains, getFirst, getLast, removeFirstOccurence, removeLastOccurence, and push HashMap items.

Note: I always try to make things easy and simple, please read comments while reading code snippet will help to understand better.

OUTPUT:

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan