Here you can find the source of printMap(Map mp)
public static final void printMap(Map mp)
//package com.java2s; /* *********************************************************************** * * project: org.matsim.*/*w w w . j a va 2 s . c o m*/ * * * *********************************************************************** * * * * copyright : (C) 2010 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * * *********************************************************************** * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ import java.util.Iterator; import java.util.Map; public class Main { public static final void printMap(Map mp) { Iterator it = mp.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); it.remove(); // avoids a ConcurrentModificationException } } }