title: Iterating generic array of any type in Java
body: <p>If there is an instance of Java Collection which may carry primitive type, generic array, and/or iterable collection, I want to treat the generic array as Iterable collection, but how? e.g. the following pseudo java code</p>
  
  <pre><code>List&lt;?&gt; list1; 
  list1.add(new int[2]); 
  list1.add(new String[3]); 
  list1.add(new ArrayList());
  for (Object e : list1){
      if (e instanceof Iterable){ 
          //The int[2] and String[3] will not fall in this case that I want it be
          //Iterate within e
      }
  }
  </code></pre>
  
  <p>Please advise how to make the int[2] and String[3] fall in the case.</p>
  
  <p>Thanks &amp; regards,
  William</p>