public static <NodeType extends IViewableNode> Rectangle2D calculateBoundingBox(
      final Collection<NodeType> nodes) {
    Preconditions.checkNotNull(nodes, "Node list argument can't be null");
    Preconditions.checkArgument(nodes.size() != 0, "Node list argument can't be empty");

    final Rectangle2D box = new Rectangle2D.Double();

    for (final NodeType node : nodes) {
      node.calcUnionRect(box);
    }

    return box;
  }
Calculates the bounding box of a list of nodes.

@param <NodeType> The type of the nodes in the list.
@param nodes The list of nodes.
@return The bounding box of the list of nodes.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/zygraph/helpers/GraphHelpers.java