Serialize generic list to file
<p>My object list is populated from a method call</p>

<pre><code>List&lt;Object&gt; returnedObjects = ...;
for (Object object : returnedObjects)
{
    if(object.getClass().equals(type1Type.class))
    {
        //Write properties to file for testing
        type1Type type1 = (type1Type)object
        //write type1.property1 to file
    }else if(object.getClass().equals(type2Type.class))
    {
        //Write properties to file for testing
    }
}
</code></pre>

<p>Instead of iterating through the object collection and then writing out the properties, is there a way to write the entire list to file so that I can look at the various objects types and it properties?</p>
