class DefaultDependencyManagementImporter implements DependencyManagementImporter {

    @Override
    public Model importManagement(
            Model target,
            List<? extends DependencyManagement> sources,
            ModelBuildingRequest request,
            ModelProblemCollector problems) {
        if (sources != null && !sources.isEmpty()) {
            Map<String, Dependency> dependencies = new LinkedHashMap<>();

            DependencyManagement depMgmt = target.getDependencyManagement();

            if (depMgmt != null) {
                for (Dependency dependency : depMgmt.getDependencies()) {
                    dependencies.put(dependency.getManagementKey(), dependency);
                }
            } else {
                depMgmt = DependencyManagement.newInstance();
            }

            Set<String> directDependencies = new HashSet<>(dependencies.keySet());

            for (DependencyManagement source : sources) {
                for (Dependency dependency : source.getDependencies()) {
                    String key = dependency.getManagementKey();
                    Dependency present = dependencies.putIfAbsent(key, dependency);
                    if (present != null && !equals(dependency, present) && !directDependencies.contains(key)) {
                        // TODO: https://issues.apache.org/jira/browse/MNG-8004
                        problems.add(new ModelProblemCollectorRequest(
                                        ModelProblem.Severity.WARNING, ModelProblem.Version.V40)
                                .setMessage("Ignored POM import for: " + toString(dependency) + " as already imported "
                                        + toString(present) + ".  Add a the conflicting managed dependency directly "
                                        + "to the dependencyManagement section of the POM."));
                    }
                }
            }

            return target.withDependencyManagement(depMgmt.withDependencies(dependencies.values()));
        }
        return target;
    }

    private String toString(Dependency dependency) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder
                .append(dependency.getGroupId())
                .append(":")
                .append(dependency.getArtifactId())
                .append(":")
                .append(dependency.getType());
        if (dependency.getClassifier() != null && !dependency.getClassifier().isEmpty()) {
            stringBuilder.append(":").append(dependency.getClassifier());
        }
        stringBuilder
                .append(":")
                .append(dependency.getVersion())
                .append("@")
                .append(dependency.getScope() == null ? "compile" : dependency.getScope());
        if (dependency.isOptional()) {
            stringBuilder.append("[optional]");
        }
        if (!dependency.getExclusions().isEmpty()) {
            stringBuilder.append("[").append(dependency.getExclusions().size()).append(" exclusions]");
        }
        return stringBuilder.toString();
    }

    private boolean equals(Dependency d1, Dependency d2) {<FILL_FUNCTION_BODY>}

    private boolean equals(Collection<Exclusion> ce1, Collection<Exclusion> ce2) {
        if (ce1.size() == ce2.size()) {
            Iterator<Exclusion> i1 = ce1.iterator();
            Iterator<Exclusion> i2 = ce2.iterator();
            while (i1.hasNext() && i2.hasNext()) {
                if (!equals(i1.next(), i2.next())) {
                    return false;
                }
            }
            return !i1.hasNext() && !i2.hasNext();
        }
        return false;
    }

    private boolean equals(Exclusion e1, Exclusion e2) {
        return Objects.equals(e1.getGroupId(), e2.getGroupId())
                && Objects.equals(e1.getArtifactId(), e2.getArtifactId());
    }
}

        return Objects.equals(d1.getGroupId(), d2.getGroupId())
                && Objects.equals(d1.getArtifactId(), d2.getArtifactId())
                && Objects.equals(d1.getVersion(), d2.getVersion())
                && Objects.equals(d1.getType(), d2.getType())
                && Objects.equals(d1.getClassifier(), d2.getClassifier())
                && Objects.equals(d1.getScope(), d2.getScope())
                && Objects.equals(d1.getSystemPath(), d2.getSystemPath())
                && Objects.equals(d1.getOptional(), d2.getOptional())
                && equals(d1.getExclusions(), d2.getExclusions());
    
<no_super_class>