title: How can i set Header map in case of custom HTTP Request in java?
body: <p>I was using java.net.http package to create custom request. i could set additional headers to pass but can't set a header map in the request, is there any way i can do this in this particular way of making http request, or in any other method of making request.</p>
  <pre><code>HttpRequest.newBuilder()
  .uri(URI.create(targetUrl)
  .setHeader(&quot;Content-Type&quot;, &quot;application/json&quot;)
  .method(myMethod, HttpRequest.BodyPublishers.ofString(body))
  .build();
  </code></pre>
  <p>I want to set HeaderMap =&gt; <strong>Map&lt;String,List&gt;</strong> just like we are setting a single header above.</p>
  <p>It would be great if anyone could help me in this.</p>