private static List<Field> filterFieldList(List<Field> fields,Class<?> filterClass){
  List<Field> filteredFields=new LinkedList<>();
  for (  Field f : fields) {
    if ((filterClass == null) || filterClass.isAssignableFrom(f.getType())) {
      filteredFields.add(f);
    }
  }
  return filteredFields;
}

private static List < Field > filterFieldList ( List < Field > fields , Class < ? > filterClass ) { List < Field > filteredFields = new LinkedList < > ( ) ; for ( Field f : fields ) { if ( ( filterClass == null ) || filterClass . isAssignableFrom ( f . getType ( ) ) ) { filteredFields . add ( f ) ; } } return filteredFields ; }
takes a list of fields and returns only fields which are subclasses of the filterclass
