title: how to determine whether a field type is a List (or any other type of collections) using reflection?
body: <p>I have something like: </p>
  
  <pre><code>Field [] fields = claz.getDeclaredFields();
   for(Field f : fields){
      f.setAccessible(true);
      if(f.getType().equals(List.class)){
          Method m = f.getType().getMethod("size");
          int length = (Integer)m.invoke(f.get(node));
          System.out.println("length "+ length);
          }
  }
  </code></pre>
  
  <p>it does work, but I'm wondering to know if there is any other good approaches, like something that will work for all other collections (TreeSet, HashSet, etc...), or the only way is that, I have to check for each type like what I already have?</p>
  
  <p>thanks</p>