---
title: "Iterate over each Entry in a Map"  
description: "Iterate over each Entry in a Map"  
author: "Pravesh Singh"  
published: 2015-05-07  
updated: 2015-05-07  
canonical: https://www.mindstick.com/forum/23197/iterate-over-each-entry-in-a-map  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Iterate over each Entry in a Map

If I have an object implementing the [MAP](https://yourviews.mindstick.com/view/81351/nepal-parliament-s-approves-new-controversial-map-india-rejects-it-but) [interface](https://www.mindstick.com/articles/12101/interfaces-in-java-extending-interfaces) in [Java](https://www.mindstick.com/articles/12214/web-development-company-in-india-laid-on-the-foundation-of-concrete-java-programming) and I wish to iterate over every pair contained within it, what is the most [efficient](https://www.mindstick.com/articles/33637/three-tips-for-an-energy-efficient-home-for-2019) way of going through the map?

Will the ordering of [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) depend on the specific map [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) that I have for the interface?

## Replies

### Reply by Anonymous User

```
for (Map.Entry<String, String> entry : map.entrySet()){    System.out.println(entry.getKey() + "/" + entry.getValue());}
```


---

Original Source: https://www.mindstick.com/forum/23197/iterate-over-each-entry-in-a-map

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
