Here you can find the source of mapEquals(Map, ?> fst, Map, ?> snd)
public static boolean mapEquals(Map<?, ?> fst, Map<?, ?> snd)
//package com.java2s; //License from project: LGPL import java.util.Iterator; import java.util.Map; public class Main { public static boolean mapEquals(Map<?, ?> fst, Map<?, ?> snd) { if (fst != null && snd != null) { Iterator<?> ifst = fst.keySet().iterator(); Iterator<?> isnd = fst.keySet().iterator(); while (ifst.hasNext() && isnd.hasNext()) { if (!ifst.next().equals(isnd.next())) return false; }// ww w.j av a 2 s.c om if (!ifst.hasNext() && !isnd.hasNext()) { return true; } } else if (fst == null && snd == null) { return true; } return false; } }