class ReferenceBook implements Comparable<ReferenceBook>, Serializable {

  public Set<IpWildcard> getAddressesRecursive(String addressGroupName) {
    Set<String> allGroupNames = new HashSet<>();
    addGroupAndDescendantNames(addressGroupName, allGroupNames);
    return allGroupNames.stream()
        // get() is safe because we got names from the book itself
        .flatMap(groupName -> getAddressGroup(groupName).get().getAddresses().stream())
        .map(IpWildcard::parse)
        .collect(ImmutableSet.toImmutableSet());
  }

  private  ReferenceBook(
      String name,
      List<AddressGroup> addressGroups,
      List<FilterGroup> filterGroups,
      List<InterfaceGroup> interfaceGroups,
      List<ServiceEndpoint> serviceEndpoints,
      List<ServiceObjectGroup> serviceObjectGroups,
      List<ServiceObject> serviceObjects);

}