This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
In some legacy code I have a method called getObjects which accepts a Hashtable as an argument. Inside the method the Hashtable is populated with the objects, making use of 'pass by value' I believe. The method returns void. However, I think it would be simpler for the method to take no arguments and return a Hashtable of the objects. Can anyone tell me what are the advantages/disadvantages of passing an object into a method and modifying its contents as opposed to returning the object directly? First way: