This can be simplified to: return value != null && value.equals(entry)