Here you can find the source of printIterator(Iterator
public static <K, V> void printIterator(Iterator<Map.Entry<K, V>> it)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; import java.util.Map; public class Main { public static <K, V> void printIterator(Iterator<Map.Entry<K, V>> it) { while (it.hasNext()) { Map.Entry<K, V> entry = it.next(); System.out.println(entry.getKey() + " " + entry.getValue()); }/*from ww w . jav a2 s . c o m*/ } }