diff --git a/src/main/java/org/springframework/hateoas/CollectionModel.java b/src/main/java/org/springframework/hateoas/CollectionModel.java index 5761cc77e..b01952d18 100644 --- a/src/main/java/org/springframework/hateoas/CollectionModel.java +++ b/src/main/java/org/springframework/hateoas/CollectionModel.java @@ -350,7 +350,7 @@ private static ResolvableType deriveElementType(Collection elements, @Nullabl } return elements.stream() - .filter(it -> it != null) + .filter(Objects::nonNull) .> map(Object::getClass) .reduce(ClassUtils::determineCommonAncestor) .map(ResolvableType::forClass) diff --git a/src/main/java/org/springframework/hateoas/UriTemplate.java b/src/main/java/org/springframework/hateoas/UriTemplate.java index 4f7680c7c..3c3589d1e 100644 --- a/src/main/java/org/springframework/hateoas/UriTemplate.java +++ b/src/main/java/org/springframework/hateoas/UriTemplate.java @@ -28,6 +28,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.Objects; import org.jspecify.annotations.Nullable; import org.springframework.hateoas.TemplateVariable.VariableType; @@ -462,7 +463,7 @@ public String expand(Map parameters) { return type.join(variables.stream() .map(it -> it.expand(parameters)) - .filter(it -> it != null) + .filter(Objects::nonNull) .collect(Collectors.toList())); } diff --git a/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java b/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java index d47cee192..096f5b64b 100644 --- a/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java +++ b/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java @@ -346,7 +346,7 @@ public AnnotatedProperty(Property property) { .orElseThrow(() -> new IllegalStateException("Could not resolve value!")); this.annotations = Stream.of(property.getReadMethod(), property.getWriteMethod(), field) // - .filter(it -> it != null) // + .filter(Objects::nonNull) // .map(MergedAnnotations::from) // .collect(Collectors.toList());