Polish: Lambdas should be replaced with method references

This commit is contained in:
igor-suhorukov
2018-02-10 02:43:13 +03:00
committed by Juergen Hoeller
parent d3a1d44864
commit 6ea0af3540
9 changed files with 15 additions and 14 deletions

View File

@@ -24,6 +24,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -249,7 +250,7 @@ public class ReactiveAdapterRegistry {
registry.registerReactiveType(
multiValue(io.reactivex.Flowable.class, io.reactivex.Flowable::empty),
source -> (io.reactivex.Flowable<?>) source,
source-> io.reactivex.Flowable.fromPublisher(source)
Flowable::fromPublisher
);
registry.registerReactiveType(
multiValue(io.reactivex.Observable.class, io.reactivex.Observable::empty),

View File

@@ -88,7 +88,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
* @return a new {@link ConvertingComparator} instance
*/
public static <K, V> ConvertingComparator<Map.Entry<K, V>, K> mapEntryKeys(Comparator<K> comparator) {
return new ConvertingComparator<>(comparator, source -> source.getKey());
return new ConvertingComparator<>(comparator, Map.Entry::getKey);
}
/**
@@ -98,7 +98,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
* @return a new {@link ConvertingComparator} instance
*/
public static <K, V> ConvertingComparator<Map.Entry<K, V>, V> mapEntryValues(Comparator<V> comparator) {
return new ConvertingComparator<>(comparator, source -> source.getValue());
return new ConvertingComparator<>(comparator, Map.Entry::getValue);
}

View File

@@ -109,7 +109,7 @@ public class PropertyPlaceholderHelper {
*/
public String replacePlaceholders(String value, final Properties properties) {
Assert.notNull(properties, "'properties' must not be null");
return replacePlaceholders(value, placeholderName -> properties.getProperty(placeholderName));
return replacePlaceholders(value, properties::getProperty);
}
/**

View File

@@ -583,7 +583,7 @@ public abstract class ReflectionUtils {
*/
public static Method[] getAllDeclaredMethods(Class<?> leafClass) {
final List<Method> methods = new ArrayList<>(32);
doWithMethods(leafClass, method -> methods.add(method));
doWithMethods(leafClass, methods::add);
return methods.toArray(new Method[methods.size()]);
}