void (Field @NotNull [] fields, @NotNull Object from, @NotNull Object to, @Nullable DifferenceFilter<?> diffFilter) { //noinspection SSBasedInspection Set<Field> sourceFields = new HashSet<>(Arrays.asList(from.getClass().getFields())); for (Field field : fields) { if (sourceFields.contains(field)) { if (isPublic(field) && !isFinal(field)) { try { if (diffFilter == null || diffFilter.test(field)) { copyFieldValue(from, to, field); } } catch (Exception e) { throw new RuntimeException(e); } } } } }