code: public void addExternalDependencies() {
          final Set<Element> components = new HashSet<>();
          getElements().stream()
                  .map(ElementView::getElement)
                  .filter(e -> e instanceof Component)
                  .forEach(components::add);
  
          // add relationships of all other elements to or from our inside components
          for (Relationship relationship : getContainer().getModel().getRelationships()) {
              if (components.contains(relationship.getSource())) {
                  addExternalDependency(relationship.getDestination(), components);
              }
              if (components.contains(relationship.getDestination())) {
                  addExternalDependency(relationship.getSource(), components);
              }
          }
  
          // remove all relationships between elements outside of this container
          getRelationships().stream()
                  .map(RelationshipView::getRelationship)
                  .filter(r -> !components.contains(r.getSource()) && !components.contains(r.getDestination()))
                  .forEach(this::remove);
      }
docs: <p>Adds all {@link Element}s external to the container (Person, SoftwareSystem or Container)
  that have {@link Relationship}s <b>to</b> or <b>from</b> {@link Component}s in this view.</p>
  <p>Not included are:</p>
  <ul>
  <li>References to and from the {@link Container} of this view (only references to and from the components are considered)</li>
  <li>{@link Relationship}s between external {@link Element}s (i.e. elements that are not part of this container)</li>
  </ul>
  <p>Don't forget to add elements to your view prior to calling this method, e.g. by calling {@link #addAllComponents()}
  or be selectively choosing certain components.</p>