Passing parameters cleanly
<p>I'm writing an API wrapper for a web service and have methods that look like this:</p>

<pre><code>public void login(String username, String password) {
    HashMap&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();
    params.put("username", username);
    params.put("password", password);
    makeRequest("/user/login", "POST", params);
}
</code></pre>

<p>This works, but is there a neater/cleaner way of writing this in Java? For example a different collection that doesn't need <code>&lt;String, Object&gt;</code> specified each time or a way to do it inline (in Javascript I'd be writing <code>makeRequest("/user/login", "POST", {"username": username, "password": password});</code>). I have a feeling that Java needs you to be a bit more verbose like this but I'd like to find out earlier rather than later.</p>
