Skip to content

Commit 364570e

Browse files
committed
fix sonar remark
1 parent d48af2b commit 364570e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/com/contentgrid/hateoas/client/hal/HalDocument.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ public HalLink getSelfLink() {
5151
}
5252

5353
public Optional<HalLink> getLink(@NonNull String rel, @NonNull String name) {
54-
return getLinks(rel).flatMap(links -> links.stream()
54+
return getLinks(rel).flatMap(linksForRel -> linksForRel.stream()
5555
.filter(link -> Objects.equals(name, link.getName()))
5656
.findFirst());
5757
}
5858

5959
public Optional<HalLink> getLink(@NonNull String rel) {
6060
return Optional.ofNullable(this.links.get(rel))
61-
.flatMap(links -> {
62-
if (links.isEmpty()) {
61+
.flatMap(linksForRel -> {
62+
if (linksForRel.isEmpty()) {
6363
return Optional.empty();
64-
} else if (links.size() == 1) {
65-
return links.stream().findFirst();
64+
} else if (linksForRel.size() == 1) {
65+
return linksForRel.stream().findFirst();
6666
}
67-
throw new RuntimeException("Expected 1 link, but has %s links".formatted(links.size()));
67+
throw new RuntimeException("Expected 1 link, but has %s links".formatted(linksForRel.size()));
6868
});
6969
}
7070

0 commit comments

Comments
 (0)