title: How to return multiple objects from a Java method?
body: <p>I want to return two objects from a Java method and was wondering what could be a good way of doing so?</p>
  
  <p>The possible ways I can think of are: return a <code>HashMap</code> (since the two Objects are related) or return an <code>ArrayList</code> of <code>Object</code> objects.</p>
  
  <p>To be more precise, the two objects I want to return are (a) <code>List</code> of objects and (b) comma separated names of the same.</p>
  
  <p>I want to return these two Objects from one method because I dont want to iterate through the list of objects to get the comma separated names (which I can do in the same loop in this method).</p>
  
  <p>Somehow, returning a <code>HashMap</code> does not look a very elegant way of doing so.</p>