---
title: "遍历Map"
author: "独家冠名"
date: "2008-03-20T19:28:23Z"
tags: ["IDEA", "Java"]
slug: "map"
draft: false
lastmod: "2008-03-20T19:28:23Z"
id: 174278
url: "https://singlewolf.iteye.com/blog/174278"
---

```java

public class IteratorMap {
	public static void main(String[] args) {
		Map map = new HashMap();
		map.put("test", "test");
		map.put("name", "dahai");
		for(Iterator it = map.entrySet().iterator();it.hasNext();){
			Map.Entry entry = (Map.Entry)it.next();
			Object key = entry.getKey();
			Object val = entry.getValue();
		}
	}
}

```