DATACMNS-1755 - Use method references in favor of lambdas.
Simplify several lambda expressions in the codebase by using method references. Original pull request: #448.
This commit is contained in:
committed by
Mark Paluch
parent
cb8443e299
commit
b42cdb6568
@@ -198,9 +198,9 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
|
||||
Collection<PersistentEntity<?, ?>> entities = contexts.stream() //
|
||||
.flatMap(it -> it.getPersistentEntities().stream()) //
|
||||
.map(it -> it.getIdProperty()) //
|
||||
.map(PersistentEntity::getIdProperty) //
|
||||
.filter(it -> it != null && type.equals(it.getTypeInformation().getActualType())) //
|
||||
.map(it -> it.getOwner()) //
|
||||
.map(PersistentProperty::getOwner) //
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (entities.size() > 1) {
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends PersistentProperty<P>> {
|
||||
|
||||
private static final Predicate<PersistentProperty<? extends PersistentProperty<?>>> IS_ENTITY = it -> it.isEntity();
|
||||
private static final Predicate<PersistentProperty<? extends PersistentProperty<?>>> IS_ENTITY = PersistentProperty::isEntity;
|
||||
|
||||
private final Map<TypeAndPath, PersistentPropertyPath<P>> propertyPaths = new ConcurrentReferenceHashMap<>();
|
||||
private final MappingContext<E, P> context;
|
||||
|
||||
@@ -310,7 +310,7 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
|
||||
}
|
||||
|
||||
String builder = annotationCache.values().stream() //
|
||||
.flatMap(it -> Optionals.toStream(it)) //
|
||||
.flatMap(Optionals::toStream) //
|
||||
.map(Object::toString) //
|
||||
.collect(Collectors.joining(" "));
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class MappingInstantiationException extends RuntimeException {
|
||||
}
|
||||
|
||||
return String.format(TEXT_TEMPLATE, it.getType().getName(),
|
||||
constructor.map(c -> toString(c)).orElse("NO_CONSTRUCTOR"), //
|
||||
constructor.map(MappingInstantiationException::toString).orElse("NO_CONSTRUCTOR"), //
|
||||
String.join(",", toStringArgs));
|
||||
|
||||
}).orElse(defaultMessage);
|
||||
|
||||
Reference in New Issue
Block a user