code: public static void mergeDependencies(final Dependency dependency,
              final Dependency relatedDependency, final Set<Dependency> dependenciesToRemove) {
          dependency.addRelatedDependency(relatedDependency);
          for (Dependency d : relatedDependency.getRelatedDependencies()) {
              dependency.addRelatedDependency(d);
              relatedDependency.removeRelatedDependencies(d);
          }
          //TODO this null check was added for #1296 - but I believe this to be related to virtual dependencies
          //  we may want to merge project references on virtual dependencies...
          if (dependency.getSha1sum() != null && dependency.getSha1sum().equals(relatedDependency.getSha1sum())) {
              dependency.addAllProjectReferences(relatedDependency.getProjectReferences());
          }
          if (dependenciesToRemove != null) {
              dependenciesToRemove.add(relatedDependency);
          }
      }
docs: Adds the relatedDependency to the dependency's related dependencies.
  
  @param dependency the main dependency
  @param relatedDependency a collection of dependencies to be removed from
  the main analysis loop, this is the source of dependencies to remove
  @param dependenciesToRemove a collection of dependencies that will be
  removed from the main analysis loop, this function adds to this
  collection