title: Best practice for passing many arguments to method?
body: <p>Occasionally , we have to write methods that receive many many arguments , for example :</p>
  
  <pre><code>public void doSomething(Object objA , Object objectB ,Date date1 ,Date date2 ,String str1 ,String str2 )
  {
  }
  </code></pre>
  
  <p>When I encounter this kind of problem , I often encapsulate arguments into a map.</p>
  
  <pre><code>Map&lt;Object,Object&gt; params = new HashMap&lt;Object,Object&gt;();
  params.put("objA",ObjA) ;
  
  ......
  
  public void doSomething(Map&lt;Object,Object&gt; params)
  {
   // extracting params 
   Object objA = (Object)params.get("objA");
   ......
   }
  </code></pre>
  
  <p>This is not a good practice , encapsulate params into a map is totally a waste of efficiency.
  The good thing is , the clean signature , easy to add other params with fewest modification .
  what's the best practice for this kind of problem ?</p>