src/main/java/com/theoryinpractise/halbuilder5/ResourceRepresentation.java
public ResourceRepresentation<V> withLinks(List<Link> links) {
    links.forEach(
        link -> {
          String rel = Links.getRel(link);
          Support.checkRelType(rel);
          validateSingletonRel(rel);
        });

    final TreeMap<String, Rel> updatedRels =
        links
            .map(Links::getRel)
            .foldLeft(
                rels,
                (accum, rel) ->
                    !accum.containsKey(rel) ? accum.put(rel, Rels.natural(rel)) : accum);

    final List<Link> updatedLinks = this.links.appendAll(links);
    return new ResourceRepresentation<>(
        content, updatedLinks, updatedRels, namespaceManager, value, resources);
  }
public ResourceRepresentation<V> withLinks(List<Link> links) {
    links.forEach(
        link -> {
          String rel = Links.getRel(link);
          Support.checkRelType(rel);
          validateSingletonRel(rel);
        });

    final TreeMap<String, Rel> updatedRels =
        links
            .map(Links::getRel)
            .foldLeft(
                rels,
                (accum, rel) ->
                    !accum.containsKey(rel) ? accum.put(rel, Rels.natural(rel)) : accum);

    final List<Link> updatedLinks = this.links.appendAll(links);
    return new ResourceRepresentation<>(
        content, updatedLinks, updatedRels, namespaceManager, value, resources);
  }
public ResourceRepresentation < V > withLinks ( List < Link > links ) { links . forEach ( link -> { String rel = Links . getRel ( link ) ; Support . checkRelType ( rel ) ; validateSingletonRel ( rel ) ; } ) ; final TreeMap < String , Rel > updatedRels = links . map ( Links :: getRel ) . foldLeft ( rels , ( accum , rel ) -> ! accum . containsKey ( rel ) ? accum . put ( rel , Rels . natural ( rel ) ) : accum ) ; final List < Link > updatedLinks = this . links . appendAll ( links ) ; return new ResourceRepresentation <> ( content , updatedLinks , updatedRels , namespaceManager , value , resources ) ; }
Add a link to this resource.

@param links The target link
Add a link to this resource .