Method#getReturnType returns a single class object, a class object corresponding to a method declaration. If the return a Collection method is declared, you will see the collection. If it is declared to return a subclass of Collection ( List', ..), you'll need to check, if Collection` can be assigned from the actual return type:
Class<?> realClass = methods[i].getReturnType(); // this is a real class / implementation if (Collection.isAssignableFrom(realClass)) { // skip collections (sic!) }
source share