title: java: how to check the type of an ArrayList as a whole
body: <p>i know how to hard code an algorithm on how to check the types of each object in an arraylist, but is there any other way in checking the type of that ArrayList&lt;> in one go, i mean my application has only three types of arraylist. Say i have a function that returns an ArrayList, and its definiton is that in a variable o (its an arraylist of object ofcourse) i'll add a person object, </p>
  
  <pre><code>o.add(person);
  </code></pre>
  
  <p>and having added all person data on an arraylist of objects and when a call this function say the name of my function is getData(), </p>
  
  <pre><code>ArrayList &lt;Object&gt; obj = getData();
  </code></pre>
  
  <p>so i know that in that ArrayList that i returned from calling getData() that it is all person object, how do i know the type of that ArrayList?.</p>
  
  <p>Just wanted that function to be more generic in sense, this is for my application though, geniric troughout my application. </p>
  
  <p>Is there any other way of doing this, i can think of an algorithm but is there any short cut or easy way of doing this?.. </p>