Detect type of object in ArrayList
<p>I'm attempting to make a class that will convert ArrayLists of objects into ArrayLists of other objects. i.e.</p>

<pre><code>ArrayList&lt;Foo&gt; convert(ArrayList&lt;Bar&gt; input){
     //conversion logic
}

ArrayList&lt;Bar&gt; convert(ArrayList&lt;Foo&gt; input){
     //conversion logic
}
</code></pre>

<p>Unfortunately Java doesn't want to have two functions with the same name and what it believes to be the same inputs and outputs.</p>

<p>I'm attempting to go a different route.  Instead of multiple functions with the same name, I want to make one function that accepts an ArrayList, determines which type of object is inside, does the proper conversion, and returns an ArrayList:</p>

<pre><code>ArrayList convert(ArrayList input){
     //conversion logic for Foo

     //conversion logic for Bar
}
</code></pre>

<p>Is something like this possible?</p>
