Compare fields of two unrelated objects
问题 I've got two objects of different classes that share some fields with the same name and type. These two objects are not related to each other. There's no possibility for me to create an interface or a parent class. Now I want to compare those shared fields and as far as I know this should be possible using reflection. These are the steps I've written for such a compare method: Field[] inputFields = input.getClass().getDeclaredFields(); for (Field field : inputFields ) { log.info(field.getName