Doesn't this work with a simple null check + putAll(properties)? MultivaluedMap extends Map so IIUC you can ditch the entrySet iteration completley